c++ - Creating unsigned 80 bit variable -
how can create 80 bit unsigned variable? after creating, need shifting operation in case; unsigned long long key=0x00000000000000000000
valid?
there const unsigned __int64
; can change unsigned __int80
?
your fundamental data types limited architecture of computer, 8-bit, 16-bit, , 32-bit integers, , possibly 64-bit integers.
some machines have clever extensions 128-bit integers, on others have compose types achieve that, done in background so-called "bigint" libraries. might, example, wrap 2 64-bit integers "128-bit integer" class transparently handles carry-over when incrementing/decrementing resulting value.
there's no particular reason can think of can't apply same logic "bigint" class wraps 64-bit integer , 16-bit integer, or 5 16-bit integers — best depends on use case, try both , measure.
i boost.largeint1, write typedef large_int<uint64_t, uint16_t> uint80_t;
on writing program.
as happens, library has examples of precisely this, 96-bit, 160-bit , 192-bit integers.
alternatively, purchase 80-bit computer.
1 confusingly so-named because submitted inclusion in boost, not because it's boost library.
Comments
Post a Comment