SURFEX v8.1
General documentation of Surfex
swapbytes_ifsaux.h
Go to the documentation of this file.
1 /* swapbytes_ifsaux.h */
2 
3 #ifndef _SWAPBYTES_H_
4 #define _SWAPBYTES_H_
5 
6 #include "privpub.h"
7 
8 /* Swap bytes : Thanks to Linux-file "/usr/include/bits/byteswap.h" for cleaness ;-) */
9 
10 /* Swap bytes in 8 bit value == does nothing; for convenience */
11 #define bswap8bits(x) (x)
12 
13 /* Swap bytes in 16 bit value. */
14 #define bswap16bits(x) \
15  ( (((x) >> 8) & 0xff) \
16  | (((x) & 0xff) << 8) )
17 
18 /* Swap bytes in 32 bit value. */
19 #define bswap32bits(x) \
20  ( (((x) & 0xff000000) >> 24) \
21  | (((x) & 0x00ff0000) >> 8) \
22  | (((x) & 0x0000ff00) << 8) \
23  | (((x) & 0x000000ff) << 24) )
24 
25 /* Swap bytes in 64 bit value. */
26 #define bswap64bits(x) \
27  ( (((x) & 0xff00000000000000ull) >> 56) \
28  | (((x) & 0x00ff000000000000ull) >> 40) \
29  | (((x) & 0x0000ff0000000000ull) >> 24) \
30  | (((x) & 0x000000ff00000000ull) >> 8) \
31  | (((x) & 0x00000000ff000000ull) << 8) \
32  | (((x) & 0x0000000000ff0000ull) << 24) \
33  | (((x) & 0x000000000000ff00ull) << 40) \
34  | (((x) & 0x00000000000000ffull) << 56) )
35 
36 extern void swap1bytes_ifsaux_
37  (void *v, const int *vlen); /* 8-bit/1-byte word swap : does nothing; for convenience */
38 
39 extern void swap2bytes_ifsaux_
40  (void *v, const int *vlen); /* 16-bit/2-byte word swap */
41 
42 extern void swap4bytes_ifsaux_
43  (void *v, const int *vlen); /* 32-bit/4-byte word swap */
44 
45 extern void swap8bytes_ifsaux_
46  (void *v, const int *vlen); /* 64-bit/8-byte word swap */
47 
48 extern void
49 swapANYbytes_ifsaux(void *v, int elsize, int n, unsigned int dtype,
50  const char *dtype_name, const char *varname);
51 
52 #endif /* _SWAPBYTES_H_ */
void swap8bytes_ifsaux_(void *v, const int *vlen)
ERROR in n
Definition: ecsort_shared.h:90
void swap4bytes_ifsaux_(void *v, const int *vlen)
void swapANYbytes_ifsaux(void *v, int elsize, int n, unsigned int dtype, const char *dtype_name, const char *varname)
void swap2bytes_ifsaux_(void *v, const int *vlen)
void swap1bytes_ifsaux_(void *v, const int *vlen)