3 ms·
On the flip side: Want to read a file of records into an array of structs?
by psyc 10y ago
On the flip side: Want to read a file of records into an array of structs?
- loup-vaillant 10y agoEvery machine in the world is Little Endian, and I'm going to specify a file format -- https://en.wikipedia.org/wiki/WAV https://en.wikipedia.org/wiki/WAV -- with C structs and type punning. Seriously, Microsoft? Me, I just static uint32_t load32_le(const uint8_t s[8]) { return (uint32_t)s[0] | ((uint32_t)s[1] << 8) | ((uint32_t)s[2] << 16) | ((uint32_t)s[3] << 24); }