# (c) Copyright 2007 The Board of Trustees of the University of Illinois. import struct def uint16(f): """Read a 16-bit unsigned integer from f.""" [c, c2] = f.read(2) return ord(c) + (ord(c2) << 8) def uint32(f): """Read a 32-bit unsigned integer from f.""" [c, c2, c3, c4] = f.read(4) return ord(c) + (ord(c2) << 8) + (ord(c3) << 16) + (ord(c4) << 24) def float(f): """Read a floating-point number from f.""" s = f.read(4) (n,) = struct.unpack("