1
#if defined (HAVE_CONFIG_H)
10
void swap4byte(void *ptr, size_t size)
12
static const char *func = "swap4byte";
17
if ( nval < 0 ) nval = 0;
18
ptrtmp = (INT32 *) ptr;
20
if ( sizeof(INT32) == 4 )
24
*ptrtmp = (((*ptrtmp >> 24) & 0x00ff) | ((*ptrtmp & 0x00ff) << 24) |
25
((*ptrtmp >> 8) & 0xff00) | ((*ptrtmp & 0xff00) << 8));
31
Error(func, "not implemented for %d byte data", sizeof(INT32));
35
void swap8byte(void *ptr, size_t size)
37
static const char *func = "swap8byte";
42
if ( nval < 0 ) nval = 0;
43
ptrtmp = (INT64 *) ptr;
45
if ( sizeof(INT64) == 8 )
49
*ptrtmp = (((*ptrtmp >> 56) & 0x000000ff) | ((*ptrtmp & 0x000000ff) << 56) |
50
((*ptrtmp >> 40) & 0x0000ff00) | ((*ptrtmp & 0x0000ff00) << 40) |
51
((*ptrtmp >> 24) & 0x00ff0000) | ((*ptrtmp & 0x00ff0000) << 24) |
52
((*ptrtmp >> 8) & 0xff000000) | ((*ptrtmp & 0xff000000) << 8));
58
Error(func, "not implemented for %d byte data", sizeof(INT64));