Portable C++: Unpacking integers from binary buffers