From gavink, for shorter-than-int integer values, on big endian host