Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any predefined type for unsigned 96 bit integer?

Tags:

c

linux

I am working on a feature which needs to keep track of a bit-map of length 96. I use this map to program asic below. Is there a standard integer type to hold 96 bits. For 64 bits, we have unsigned long long. Anything similar for 96 bits? Any alternate suggestion welcome as well.

PS: This is Cisco OS based on linux. Language is C.

like image 561
Deepanjan Mazumdar Avatar asked Mar 11 '26 20:03

Deepanjan Mazumdar


1 Answers

I'd probably go with an array of 3 uint's. That should be fast enough, and not a lot more complex.

EG, to set a bit:

wordNo = i / 32
bitNo = i - (32*wordNo)
mask = 2 ** bitNo

array[wordNo] |= mask

...or thereabout.

like image 89
user1277476 Avatar answered Mar 13 '26 09:03

user1277476