Method: CRC::Utils#bitreflect
- Defined in:
- lib/crc/_utils.rb
#bitreflect(num, bitsize) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/crc/_utils.rb', line 14 def bitreflect(num, bitsize) case when bitsize > 128 bitreflect_reference(num, bitsize) when bitsize > 64 bitreflect128(num) >> (128 - bitsize) when bitsize > 32 bitreflect64(num) >> (64 - bitsize) when bitsize > 16 bitreflect32(num) >> (32 - bitsize) when bitsize > 8 bitreflect16(num) >> (16 - bitsize) else bitreflect8(num) >> (8 - bitsize) end end |