X-Git-Url: http://git.tremily.us/?p=igor.git;a=blobdiff_plain;f=igor%2Fbinarywave.py;fp=igor%2Fbinarywave.py;h=f9c4e18a2a87e681c1aff6eb61bab5ff11d04a70;hp=70af3107b61bf5bdbe9df90cb24c9dda394f3c9c;hb=f80fadab6d17098793f14f443d0a88aab648ebf8;hpb=ead1da8aab6d15db20adb1434467cc7f0846778e diff --git a/igor/binarywave.py b/igor/binarywave.py index 70af310..f9c4e18 100644 --- a/igor/binarywave.py +++ b/igor/binarywave.py @@ -36,6 +36,7 @@ from .struct import Structure as _Structure from .struct import Field as _Field from .util import assert_null as _assert_null from .util import byte_order as _byte_order +from .util import need_to_reorder_bytes as _need_to_reorder_bytes from .util import checksum as _checksum @@ -226,15 +227,6 @@ WaveHeader5 = _Structure( # End IGOR constants and typedefs from IgorBin.h -# Begin functions from ReadWave.c - -def _need_to_reorder_bytes(version): - # If the low order byte of the version field of the BinHeader - # structure is zero then the file is from a platform that uses - # different byte-ordering and therefore all data will need to be - # reordered. - return version & 0xFF == 0 - def _version_structs(version, byte_order): if version == 1: bin = BinHeader1 @@ -271,7 +263,7 @@ def load(filename, strict=True): version = BinHeaderCommon.unpack_dict_from(b)['version'] needToReorderBytes = _need_to_reorder_bytes(version) byteOrder = _byte_order(needToReorderBytes) - + if needToReorderBytes: BinHeaderCommon.set_byte_order(byteOrder) version = BinHeaderCommon.unpack_dict_from(b)['version']