Wire Sysio
Wire Sysion 1.0.0
Loading...
Searching...
No Matches
inttype.hpp
Go to the documentation of this file.
1
#pragma once
8
#if defined(_MSC_VER) && (MSC_VER <= 1500)
9
typedef
__int64
int64_t
;
10
typedef
unsigned
__int64
uint64_t
;
11
typedef
unsigned
int
uint32_t
;
12
typedef
int
int32_t
;
13
typedef
unsigned
short
uint16_t
;
14
typedef
short
int16_t
;
15
typedef
unsigned
char
uint8_t
;
16
typedef
signed
char
int8_t
;
17
#else
18
#include <
stdint.h
>
19
#endif
20
21
#ifdef _MSC_VER
22
#ifndef CYBOZU_DEFINED_SSIZE_T
23
#define CYBOZU_DEFINED_SSIZE_T
24
#ifdef _WIN64
25
typedef
int64_t
ssize_t;
26
#else
27
typedef
int32_t
ssize_t;
28
#endif
29
#endif
30
#else
31
#include <unistd.h>
// for ssize_t
32
#endif
33
34
#ifndef CYBOZU_ALIGN
35
#ifdef _MSC_VER
36
#define CYBOZU_ALIGN(x) __declspec(align(x))
37
#else
38
#define CYBOZU_ALIGN(x) __attribute__((aligned(x)))
39
#endif
40
#endif
41
#ifndef CYBOZU_ALLOCA
42
#ifdef _MSC_VER
43
#include <malloc.h>
44
#define CYBOZU_ALLOCA(x) _malloca(x)
45
#else
46
#define CYBOZU_ALLOCA_(x) __builtin_alloca(x)
47
#endif
48
#endif
49
#ifndef CYBOZU_FOREACH
50
// std::vector<int> v; CYBOZU_FOREACH(auto x, v) {...}
51
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
52
#define CYBOZU_FOREACH(type_x, xs) for each (type_x in xs)
53
#elif defined(__GNUC__)
54
#define CYBOZU_FOREACH(type_x, xs) for (type_x : xs)
55
#endif
56
#endif
57
#ifndef CYBOZU_NUM_OF_ARRAY
58
#define CYBOZU_NUM_OF_ARRAY(x) (sizeof(x) / sizeof(*x))
59
#endif
60
#ifndef CYBOZU_SNPRINTF
61
#ifdef _MSC_VER
62
#define CYBOZU_SNPRINTF(x, len, ...) (void)_snprintf_s(x, len, len - 1, __VA_ARGS__)
63
#else
64
#define CYBOZU_SNPRINTF(x, len, ...) (void)snprintf(x, len, __VA_ARGS__)
65
#endif
66
#endif
67
68
#define CYBOZU_CPP_VERSION_CPP03 0
69
#define CYBOZU_CPP_VERSION_TR1 1
70
#define CYBOZU_CPP_VERSION_CPP11 2
71
72
#if (__cplusplus >= 201103) || (_MSC_VER >= 1500) || defined(__GXX_EXPERIMENTAL_CXX0X__)
73
#if defined(_MSC_VER) && (_MSC_VER <= 1600)
74
#define CYBOZU_CPP_VERSION CYBOZU_CPP_VERSION_TR1
75
#else
76
#define CYBOZU_CPP_VERSION CYBOZU_CPP_VERSION_CPP11
77
#endif
78
#elif (__GNUC__ >= 4 && __GNUC_MINOR__ >= 5) || (__clang_major__ >= 3)
79
#define CYBOZU_CPP_VERSION CYBOZU_CPP_VERSION_TR1
80
#else
81
#define CYBOZU_CPP_VERSION CYBOZU_CPP_VERSION_CPP03
82
#endif
83
84
#if (CYBOZU_CPP_VERSION == CYBOZU_CPP_VERSION_TR1)
85
#define CYBOZU_NAMESPACE_STD std::tr1
86
#define CYBOZU_NAMESPACE_TR1_BEGIN namespace tr1 {
87
#define CYBOZU_NAMESPACE_TR1_END }
88
#else
89
#define CYBOZU_NAMESPACE_STD std
90
#define CYBOZU_NAMESPACE_TR1_BEGIN
91
#define CYBOZU_NAMESPACE_TR1_END
92
#endif
93
94
#ifndef CYBOZU_OS_BIT
95
#if defined(_WIN64) || defined(__x86_64__)
96
#define CYBOZU_OS_BIT 64
97
#else
98
#define CYBOZU_OS_BIT 32
99
#endif
100
#endif
101
102
103
#ifndef CYBOZU_ENDIAN
104
#define CYBOZU_ENDIAN_UNKNOWN 0
105
#define CYBOZU_ENDIAN_LITTLE 1
106
#define CYBOZU_ENDIAN_BIG 2
107
#if defined(_M_IX86) || defined(_M_AMD64) || defined(__x86_64__) || defined(__i386__)
108
#define CYBOZU_ENDIAN CYBOZU_ENDIAN_LITTLE
109
#else
110
#define CYBOZU_ENDIAN CYBOZU_ENDIAN_UNKNOWN
111
#endif
112
#endif
113
114
namespace
cybozu
{
115
template
<
class
T>
116
void
disable_warning_unused_variable
(
const
T
&) { }
117
template
<
class
T,
class
S>
118
T
cast
(
const
S
* ptr) {
return
static_cast<
T
>
(
static_cast<
const
void
*
>
(ptr)); }
119
template
<
class
T,
class
S>
120
T
cast
(
S
* ptr) {
return
static_cast<
T
>
(
static_cast<
void
*
>
(ptr)); }
121
}
// cybozu
cybozu
Definition
benchmark.hpp:25
cybozu::disable_warning_unused_variable
void disable_warning_unused_variable(const T &)
Definition
inttype.hpp:116
cybozu::cast
T cast(const S *ptr)
Definition
inttype.hpp:118
T
#define T(meth, val, expected)
stdint.h
int16_t
signed short int16_t
Definition
stdint.h:122
uint16_t
unsigned short uint16_t
Definition
stdint.h:125
int64_t
signed __int64 int64_t
Definition
stdint.h:135
uint32_t
unsigned int uint32_t
Definition
stdint.h:126
int32_t
signed int int32_t
Definition
stdint.h:123
uint8_t
unsigned char uint8_t
Definition
stdint.h:124
uint64_t
unsigned __int64 uint64_t
Definition
stdint.h:136
int8_t
signed char int8_t
Definition
stdint.h:121
S
Definition
Tricky.tests.cpp:326
libraries
fc
libraries
ff
depends
xbyak
test
cybozu
inttype.hpp
Generated by
1.12.0