3 ms·
Could it be that this runs on little endian? And some code is accessing a 16 or 32 bit integer as though it were just a byte, so it gets only the low 8 bits? T
by kazinator 10y ago
Could it be that this runs on little endian? And some code is accessing a 16 or 32 bit integer as though it were just a byte, so it gets only the low 8 bits?
This the one disadvantage of little endian: an aliasing bug between different integer widths is hidden if the code isn't tested with sufficiently large values. On big endian, it's likely an instant show-stopper, since small values near zero map to zero.
Note how the issue is that the value can't be a multiple of 256: i.e. have the least eight significant bits clear. That's troubling still, because although an axle count of 257 mitigates the signaling problem, the strong suspicion lingers remains that this 257 might be treated as an axle count of 1; and doesn't that have ramifications? I.e. it might be used as an 8 bit value for more than just an "do we have axles or not" test.
- gsnedders 10y agoThe systems with these limitations are mostly 1970s systems based on 8-bit microcontrollers, so I strongly suspect that they're using 8-bit integers. And yes, there are concerns about modulo behaviour, but this ultimately is an engineering trade-off: what is the probability of losing exactly 2^8 axles from a consist?