3 ms·
> and those don't really depend on data layout. Not sure I understood this, but 01+09 = 10 and 10+90 = 100 and 10 ≠ fix_endianness(100)
by gugagore 9y ago
> and those don't really depend on data layout.
Not sure I understood this, but 01+09 = 10 and 10+90 = 100 and 10 ≠ fix_endianness(100)
- rkeene2 9y ago10!=01 and 09!=90 The endian-ness is only the in-memory layout of the bits and has nothing to do with how VALUES are treated. 1+9=10, regardless of how those values are stored, similarly 1<<9=512, regardless of how the CPU internally arranges those bits. The same holds true for inverting the value, the internal arrangement of the bits is irrelevant. Really you only care about endianness when you fail to treat numbers as numbers, for example by treating them as bytes.