summaryrefslogtreecommitdiff
path: root/src/common/common_funcs.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/common_funcs.h')
-rw-r--r--src/common/common_funcs.h17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h
index 91b74c6bc..59bd16dbf 100644
--- a/src/common/common_funcs.h
+++ b/src/common/common_funcs.h
@@ -5,15 +5,6 @@
5#pragma once 5#pragma once
6 6
7#include "common_types.h" 7#include "common_types.h"
8#include <cstdlib>
9
10
11#define b2(x) ( (x) | ( (x) >> 1) )
12#define b4(x) ( b2(x) | ( b2(x) >> 2) )
13#define b8(x) ( b4(x) | ( b4(x) >> 4) )
14#define b16(x) ( b8(x) | ( b8(x) >> 8) )
15#define b32(x) (b16(x) | (b16(x) >>16) )
16#define ROUND_UP_POW2(x) (b32(x - 1) + 1)
17 8
18#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) 9#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
19 10
@@ -43,8 +34,6 @@
43 34
44#ifndef _MSC_VER 35#ifndef _MSC_VER
45 36
46#include <errno.h>
47
48#if defined(__x86_64__) || defined(_M_X64) 37#if defined(__x86_64__) || defined(_M_X64)
49#define Crash() __asm__ __volatile__("int $3") 38#define Crash() __asm__ __volatile__("int $3")
50#elif defined(_M_ARM) 39#elif defined(_M_ARM)
@@ -80,8 +69,10 @@ inline u64 _rotr64(u64 x, unsigned int shift){
80} 69}
81 70
82#else // _MSC_VER 71#else // _MSC_VER
83 // Function Cross-Compatibility 72 #if (_MSC_VER < 1900)
84 #define snprintf _snprintf 73 // Function Cross-Compatibility
74 #define snprintf _snprintf
75 #endif
85 76
86 // Locale Cross-Compatibility 77 // Locale Cross-Compatibility
87 #define locale_t _locale_t 78 #define locale_t _locale_t