License:
BSD style: see license.txt
Version:
Initial release: October 2004
Version:
Feb 20th 2005 - Asm version removed by Aleksey Bobnev
author:
Kris, Aleksey Bobnev
$(DDOC_MODULE_MEMBERS
struct
ByteSwap
;
$(DDOC_DECL_DD Reverse byte order for specific datum sizes. Note that the
byte-swap approach avoids alignment issues, so is probably
faster overall than a traditional 'shift' implementation.
ubyte[] x = [0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08];
swap16 (x) => 02 01 04 03 06 05 08 07
swap32 (x) => 04 03 02 01 08 07 06 05
swap64 (x) => 08 07 06 05 04 03 02 01
- static final void
swap16
(void[] dst);
- Reverses two-byte sequences. Parameter dst imples the
number of bytes, which should be a multiple of 2
- static final void
swap32
(void[] dst);
- Reverses four-byte sequences. Parameter dst implies the
number of bytes, which should be a multiple of 4
- static final void
swap64
(void[] dst);
- Reverse eight-byte sequences. Parameter dst implies the
number of bytes, which should be a multiple of 8
- static final void
swap80
(void[] dst);
- Reverse ten-byte sequences. Parameter dst implies the
number of bytes, which should be a multiple of 10
- static final void
swap16
(void* dst, uint bytes);
- Reverses two-byte sequences. Parameter bytes specifies the
number of bytes, which should be a multiple of 2
- static final void
swap32
(void* dst, uint bytes);
- Reverses four-byte sequences. Parameter bytes specifies the
number of bytes, which should be a multiple of 4
- static final void
swap64
(void* dst, uint bytes);
- Reverse eight-byte sequences. Parameter bytes specifies the
number of bytes, which should be a multiple of 8
- static final void
swap80
(void* dst, uint bytes);
- Reverse ten-byte sequences. Parameter bytes specifies the
number of bytes, which should be a multiple of 10
|