Home > Mobile >  how is 128 bit integer formed in abseil library?
how is 128 bit integer formed in abseil library?

Time:07-14

In Abseil library absl::uint128 big = absl::MakeUint128(1, 0); this represents 2^64 , but i don't understand what does '1' and '0' mean here. Can someone explain me how the number is actually formed ?

CodePudding user response:

absl::MakeUint128(x, y); constructs a number equal to 2^64 * x y

And see https://abseil.io/docs/cpp/guides/numeric

CodePudding user response:

How? In any possible way. But there is a very simple way to make it. You may already know how to do arithmetic with one digit numbers in base ten, right? Then you also know to use this arithmetic to get arithmetic of two digit numbers in base 10, right? Be aware that this then gives you an arithmetic of one digit numbers in base 100 (just consider '34' or '66' as a single symbols).

Your computer knows how to make arithmetic of one number digit in base 2^64, so it makes the same extension that you use to get in base 10 to get arithmetic of two digit numbers in base 2^64. This then leads to an arithmetic in base 2^128, or an arithmetic of 128 digits numbers in base 2.

  • Related