Changeset 82
- Timestamp:
- 10/15/07 22:29:56 (1 year ago)
- Files:
-
- trunk/OpenMeshD/OpenMesh/Core/IO/BinaryHelper.d (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/OpenMeshD/OpenMesh/Core/IO/BinaryHelper.d
r79 r82 275 275 const uint N_2 = N/2; 276 276 for (uint i=0; i<N/2; i++) { 277 util.swap((cast(byte*)&v)[i], (cast(byte*)&v)[N-i]);277 util.swap((cast(byte*)&v)[i], (cast(byte*)&v)[N-i-1]); 278 278 } 279 279 } … … 283 283 284 284 unittest { 285 286 int i = 1; 287 swap_endian(i); 288 assert(i == 0x01_00_00_00, "int swapped incorrectly"); 289 long l = 1; 290 swap_endian(l); 291 assert(l == 0x01_00_00_00__00_00_00_00L, "long swapped incorrectly"); 292 l = 0x01_02_03_04__05_06_07_08L; 293 swap_endian(l); 294 assert(l == 0x08_07_06_05__04_03_02_01L, "long swapped incorrectly"); 285 295 286 296 }
