Module: GPS_PVT::Util::CRC24Q
- Defined in:
- lib/gps_pvt/util.rb
Constant Summary collapse
- POLY =
0x1864CFB
- TABLE =
0x100.times.collect{|i| res = i << 16 8.times{ res <<= 1 res ^= POLY if (res & 0x1000000) > 0 } res }
Class Method Summary collapse
Class Method Details
.checksum(bytes) ⇒ Object
120 121 122 123 124 |
# File 'lib/gps_pvt/util.rb', line 120 def CRC24Q.checksum(bytes) bytes.inject(0){|crc, byte| ((crc << 8) & 0xFFFF00) ^ TABLE[byte ^ ((crc >> 16) & 0xFF)] } end |