How can I create 80 bit unsigned variable? After creating, I need to do some shifting operation so in my case;
is unsigned long long key=0x00000000000000000000
valid?
There is const unsigned __int64
; can I change it with unsigned __int80
?
How can I create 80 bit unsigned variable? After creating, I need to do some shifting operation so in my case;
is unsigned long long key=0x00000000000000000000
valid?
There is const unsigned __int64
; can I change it with unsigned __int80
?
Your fundamental data types are limited by the architecture of your computer, so probably 8-bit, 16-bit, and 32-bit integers, and possibly 64-bit integers.
Some machines have clever extensions for 128-bit integers, but on others you have to compose types to achieve that, which is done for you in the background by so-called "bigint" libraries. They might, for example, wrap two 64-bit integers into a "128-bit integer" class that transparently handles the carry-over when incrementing/decrementing the resulting value.
There's no particular reason I can think of that you can't apply the same logic to a "bigint" class that wraps a 64-bit integer and a 16-bit integer, or five 16-bit integers — which is best for you depends on your use case, so you could try both and measure.
I like Boost.LargeInt1, with which you could write typedef large_int<uint64_t, uint16_t> uint80_t;
then just get on with writing your program.
As it happens, this library already has examples of precisely this, for 96-bit, 160-bit and 192-bit integers.
Alternatively, purchase an 80-bit computer.
1 Confusingly so-named because it was submitted for inclusion in Boost, not because it's actually a Boost library.