News for hackers. Stuff that matters.
Re:C++17 – better than you might think by psyc on Thursday December 29, 2016 @12:17PM (#13278499)
On the flip side: Want to read a file of records into an array of structs?
Re:C++17 – better than you might think by loup-vaillant on Thursday December 29, 2016 @01:10PM (#13278872)
Every machine in the world is Little Endian, and I'm going to specify a file format -- 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);
  }