The mismatch between the variable in the sample code defining CRC-24 and the definition of the generator in the paragraph above has been a source of confusion for over 20 years (see  for the first instance i could find in the wild). It has also been raised as an explicit erratum .
One option would be to change the CRC24_POLY variable in the code to
exactly match the generator described above. This allows the
accumulator to overflow, which on most architectures has has no
practical functional change, because of the masking step at the end of
However, allowing the
crc24 accumulator to overflow might cause
problems in some obscure architecture, as (a)
crc24 is defined as
"long", which is typically a signed type, and (b) left-shift behavior
is undefined for overflowing signed values (and also for negative
signed values) .
 http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf § 6.5.7(4)
So allowing the accumulator to overflow in the sample code seems ill-advised. This change clarifies both that the accumulator should be treated as unsigned, and aligns the variable with the textual description of the generator.