bes
Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
byteswap_compat.h
1
//
2
// Created by James Gallagher on 7/1/20.
3
// Always include "config.h" before this header.
4
//
5
6
#ifndef HYRAX_GIT_BYTESWAP_COMPAT_H
7
#define HYRAX_GIT_BYTESWAP_COMPAT_H
8
9
#ifndef _config_h
10
#error "The config.h header must be included before this header can be used"
11
#endif
12
13
#ifdef HAVE_BYTESWAP_H
14
15
// If this OS has byteswap.h, use it.
16
#include <byteswap.h>
17
18
#else
19
20
// These are the definitions used by GNULib. jhrg 7/1/20
21
22
/* Given an unsigned 16-bit argument X, return the value corresponding to
23
X with reversed byte order. */
24
#define bswap_16(x) ((((x) & 0x00FF) << 8) | \
25
(((x) & 0xFF00) >> 8))
26
27
/* Given an unsigned 32-bit argument X, return the value corresponding to
28
X with reversed byte order. */
29
#define bswap_32(x) ((((x) & 0x000000FF) << 24) | \
30
(((x) & 0x0000FF00) << 8) | \
31
(((x) & 0x00FF0000) >> 8) | \
32
(((x) & 0xFF000000) >> 24))
33
34
/* Given an unsigned 64-bit argument X, return the value corresponding to
35
X with reversed byte order. */
36
#define bswap_64(x) ((((x) & 0x00000000000000FFULL) << 56) | \
37
(((x) & 0x000000000000FF00ULL) << 40) | \
38
(((x) & 0x0000000000FF0000ULL) << 24) | \
39
(((x) & 0x00000000FF000000ULL) << 8) | \
40
(((x) & 0x000000FF00000000ULL) >> 8) | \
41
(((x) & 0x0000FF0000000000ULL) >> 24) | \
42
(((x) & 0x00FF000000000000ULL) >> 40) | \
43
(((x) & 0xFF00000000000000ULL) >> 56))
44
45
#endif
46
47
#endif
//HYRAX_GIT_BYTESWAP_COMPAT_H
modules
dmrpp_module
byteswap_compat.h
Generated by
1.13.2