File: platform.h

package info (click to toggle)
redhat-cluster 3.1.8-1.2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 4,608 kB
  • ctags: 6,306
  • sloc: ansic: 62,895; sh: 1,626; makefile: 1,143; perl: 765
file content (59 lines) | stat: -rw-r--r-- 1,141 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/** @file
 * Defines for byte-swapping
 */
#ifndef _PLATFORM_H
#define _PLATFORM_H

#include <endian.h>
#include <sys/param.h>
#include <byteswap.h>
#include <bits/wordsize.h>

/*

Configure is gone...
 #ifndef HAVE_CONFIG_H
#error "Please run configure first"
#endif

*/

/* #include <config.h> */

/* No swapping on little-endian machines */
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define le_swap16(x) (x)
#define le_swap32(x) (x)
#define le_swap64(x) (x)
#else
#define le_swap16(x) bswap_16(x)
#define le_swap32(x) bswap_32(x)
#define le_swap64(x) bswap_64(x)
#endif

/* No swapping on big-endian machines */
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define be_swap16(x) bswap_16(x)
#define be_swap32(x) bswap_32(x)
#define be_swap64(x) bswap_64(x)
#else
#define be_swap16(x) (x)
#define be_swap32(x) (x)
#define be_swap64(x) (x)
#endif


#define swab16(x) x=be_swap16(x)
#define swab32(x) x=be_swap32(x)
#define swab64(x) x=be_swap64(x)


#if defined(__sparc__)
#define ALIGNED __attribute__((aligned))
#define PACKED  __attribute__((aligned,packed))
#else
#define ALIGNED
#define PACKED __attribute__((packed))
#endif

#endif /* _PLATFORM_H */