28
28
// size_t
29
29
#include <cstddef>
30
30
31
- // define endianess and some integer data types
32
- #if defined(_MSC_VER ) || defined(__MINGW32__ )
33
- // Windows always little endian
34
31
#define __ALPACA_BYTE_ORDER __ALPACA_LITTLE_ENDIAN
35
32
33
+ // define some integer data types
34
+ #if defined(_MSC_VER ) || defined(__MINGW32__ )
36
35
// intrinsics / prefetching
37
36
#if defined(__MINGW32__ ) || defined(__clang__ )
38
37
#define ALPACA_PREFETCH (location ) __builtin_prefetch(location)
42
41
#define ALPACA_PREFETCH (location ) _mm_prefetch(location, _MM_HINT_T0)
43
42
#else
44
43
#define ALPACA_PREFETCH (location ) ;
45
- #endif
46
- #endif
44
+ #endif // __SSE2__
45
+ #endif // __MINGW32__
47
46
#elif defined(__APPLE__ ) || defined(__MACH__ )
48
- // Apple MacOS uses big endian
49
- #define __ALPACA_BYTE_ORDER __ALPACA_BIG_ENDIAN
50
-
51
47
// intrinsics / prefetching
52
48
#ifdef __GNUC__
53
49
#define ALPACA_PREFETCH (location ) __builtin_prefetch(location)
54
- #else
50
+ #else // __GNUC__
55
51
// no prefetching
56
52
#define ALPACA_PREFETCH (location ) ;
57
- #endif
53
+ #endif // __GNUC__
58
54
59
55
#elif defined(__linux__ ) || defined(__linux ) || defined(linux__ ) || \
60
56
defined(__gnu_linux__ )
61
- // defines BYTE_ORDER as __ALPACA_LITTLE_ENDIAN or __ALPACA_BIG_ENDIAN
62
57
#include <sys/param.h>
63
- #define __ALPACA_BYTE_ORDER __BYTE_ORDER
64
-
65
58
// intrinsics / prefetching
66
59
#ifdef __GNUC__
67
60
#define ALPACA_PREFETCH (location ) __builtin_prefetch(location)
68
- #else
61
+ #else // __GNUC__
69
62
// no prefetching
70
63
#define ALPACA_PREFETCH (location ) ;
71
- #endif
72
- #else
64
+ #endif // __GNUC__
65
+ #else // unknown system
73
66
#error unsupported system
74
- #endif
75
-
76
- // abort if byte order is undefined
77
- #if !defined(__ALPACA_BYTE_ORDER )
78
- #error undefined byte order, compile with -D__ALPACA_BYTE_ORDER=1234 (if little endian) or -D__ALPACA_BYTE_ORDER=4321 (big endian)
79
- #endif
67
+ #endif // system
80
68
81
69
namespace {
82
70
/// zlib's CRC32 polynomial
@@ -1386,4 +1374,4 @@ static inline uint32_t crc32_combine(uint32_t crcA, uint32_t crcB,
1386
1374
1387
1375
// return combined crc
1388
1376
return crcA ^ crcB ;
1389
- }
1377
+ }
0 commit comments