is possible declare bitfield of large numbers e.g.
struct binfield{ uber_int field : 991735910442856976773698036458045320070701875088740942522886681; }wordlist;
just clarify, i'm not trying represent number in 256bit, that's how many bits want use. or maybe there aren't many bits in computer?
c not support numeric data-types of arbitrary size. can use integer sizes provided compiler, , when want code portable, better stick minimum guaranteed sizes standardized types of char
(8 bit), short
(16 bit), , long
(32 bit) , long long
(64 bit).
but can instead create char[]
. char @ least 8 bit (and not more 8 bit either except on exotic platforms). can use array of char store many bit-values can afford memory. however, when want use char array bitfield need boilerplate code access correct byte.
for example, value of bit n
of char array, use
bitfield[n/8] >> n%8 & 0x1
Comments
Post a Comment