-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathInt64.h
More file actions
148 lines (129 loc) · 5.88 KB
/
Int64.h
File metadata and controls
148 lines (129 loc) · 5.88 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#ifndef CPP_INT64_INCLUDED
#define CPP_INT64_INCLUDED
namespace cpp
{
class Int64Handler
{
public:
static inline const char *getName() { return "cpp.Int64"; }
static inline String toString( const void *inValue ) { return String( *(Int64 *)inValue ); }
static inline void handler(DynamicHandlerOp op, void *ioValue,int inSize, void *outResult)
{
if (op==dhoToString)
*(String *)outResult = toString(ioValue);
else if (op==dhoGetClassName)
*(const char **)outResult = getName();
else if (op==dhoFromDynamic)
{
StructHandlerDynamicParams *params = (StructHandlerDynamicParams *)outResult;
cpp::Int64 &value = *(cpp::Int64 *)ioValue;
params->outProcessed = true;
if (!params->inData)
value = 0;
else
value = params->inData->__ToInt64();
}
else if (op==dhoToDynamic)
{
Dynamic value = *(cpp::Int64 *)ioValue;
*(hx::Object **)outResult = value.mPtr;
}
else if (op==dhoIs)
{
StructHandlerDynamicParams *params = (StructHandlerDynamicParams *)outResult;
hx::Object *obj = params->inData;
int type = obj->__GetType();
params->outProcessed = type==vtInt || type==vtInt64;
}
else
return DefaultStructHandler::handler(op,ioValue,inSize, outResult);
}
};
typedef Struct<Int64,Int64Handler> Int64Struct;
}
#if (HXCPP_API_LEVEL >= 420)
inline cpp::Int64 _hx_int64_make(int a, int b) { return (((cpp::Int64)(unsigned int)a)<<32) | (unsigned int)b; }
inline bool _hx_int64_is_neg(cpp::Int64 a) { return a<0; }
inline bool _hx_int64_is_zero(cpp::Int64 a) { return a==0; }
inline bool _hx_int64_eq(cpp::Int64 a, cpp::Int64 b) { return a==b; }
inline bool _hx_int64_neq(cpp::Int64 a, cpp::Int64 b) { return a!=b; }
inline int _hx_int64_compare(cpp::Int64 a, cpp::Int64 b)
{
return a==b ? 0 : a<b ? -1 : 1;
}
inline int _hx_int64_ucompare(cpp::Int64 a, cpp::Int64 b)
{
return a==b ? 0 : ( ::cpp::UInt64)a<( ::cpp::UInt64)b ? -1 : 1;
}
inline String _hx_int64_to_string(cpp::Int64 a) { return a; }
inline cpp::Int64 _hx_int64_neg(cpp::Int64 a) { return -a; }
inline cpp::Int64 _hx_int64_complement(cpp::Int64 a) { return ~a; }
inline cpp::Int64 _hx_int64_pre_increment(cpp::Int64 &ioVal) {
return ++ioVal;
}
inline cpp::Int64 _hx_int64_post_increment(cpp::Int64 &ioVal) {
return ioVal++;
}
inline cpp::Int64 _hx_int64_pre_decrement(cpp::Int64 &ioVal) {
return --ioVal;
}
inline cpp::Int64 _hx_int64_post_decrement(cpp::Int64 &ioVal) {
return ioVal--;
}
inline cpp::Int64 _hx_int64_sub(cpp::Int64 a, cpp::Int64 b) { return a-b; }
inline cpp::Int64 _hx_int64_add(cpp::Int64 a, cpp::Int64 b) { return a+b; }
inline cpp::Int64 _hx_int64_mul(cpp::Int64 a, cpp::Int64 b) { return a*b; }
inline cpp::Int64 _hx_int64_div(cpp::Int64 a, cpp::Int64 b) { return a/b; }
inline cpp::Int64 _hx_int64_mod(cpp::Int64 a, cpp::Int64 b) { return a%b; }
inline cpp::Int64 _hx_int64_and(cpp::Int64 a, cpp::Int64 b) { return a&b; }
inline cpp::Int64 _hx_int64_or(cpp::Int64 a, cpp::Int64 b) { return a|b; }
inline cpp::Int64 _hx_int64_xor(cpp::Int64 a, cpp::Int64 b) { return a^b; }
inline cpp::Int64 _hx_int64_shl(cpp::Int64 a, int b) { return a<<(b&63); }
inline cpp::Int64 _hx_int64_shr(cpp::Int64 a, int b) { return a>>(b&63); }
inline cpp::Int64 _hx_int64_ushr(cpp::Int64 a, int b) { return ((cpp::UInt64)a)>>(b&63); }
inline int _hx_int64_high(cpp::Int64 a) { return (int)( a >> 32 ); }
inline int _hx_int64_low(cpp::Int64 a) { return (int)( a & 0xffffffff ); }
#else
inline cpp::Int64Struct _hx_int64_make(int a, int b) { return (((cpp::Int64)(unsigned int)a)<<32) | (unsigned int)b; }
inline bool _hx_int64_is_neg(cpp::Int64 a) { return a<0; }
inline bool _hx_int64_is_zero(cpp::Int64 a) { return a==0; }
inline bool _hx_int64_eq(cpp::Int64 a, cpp::Int64 b) { return a==b; }
inline bool _hx_int64_neq(cpp::Int64 a, cpp::Int64 b) { return a!=b; }
inline int _hx_int64_compare(cpp::Int64 a, cpp::Int64 b)
{
return a==b ? 0 : a<b ? -1 : 1;
}
inline int _hx_int64_ucompare(cpp::Int64 a, cpp::Int64 b)
{
return a==b ? 0 : ( ::cpp::UInt64)a<( ::cpp::UInt64)b ? -1 : 1;
}
inline String _hx_int64_to_string(cpp::Int64Struct a) { return a; }
inline cpp::Int64Struct _hx_int64_neg(cpp::Int64 a) { return -a; }
inline cpp::Int64Struct _hx_int64_complement(cpp::Int64 a) { return ~a; }
inline cpp::Int64Struct _hx_int64_pre_increment(cpp::Int64Struct &ioVal) {
return ++ioVal.get();
}
inline cpp::Int64Struct _hx_int64_post_increment(cpp::Int64Struct &ioVal) {
return ioVal.get()++;
}
inline cpp::Int64Struct _hx_int64_pre_decrement(cpp::Int64Struct &ioVal) {
return --ioVal.get();
}
inline cpp::Int64Struct _hx_int64_post_decrement(cpp::Int64Struct &ioVal) {
return ioVal.get()--;
}
inline cpp::Int64Struct _hx_int64_sub(cpp::Int64 a, cpp::Int64 b) { return a-b; }
inline cpp::Int64Struct _hx_int64_add(cpp::Int64 a, cpp::Int64 b) { return a+b; }
inline cpp::Int64Struct _hx_int64_mul(cpp::Int64 a, cpp::Int64 b) { return a*b; }
inline cpp::Int64Struct _hx_int64_div(cpp::Int64 a, cpp::Int64 b) { return a/b; }
inline cpp::Int64Struct _hx_int64_mod(cpp::Int64 a, cpp::Int64 b) { return a%b; }
inline cpp::Int64Struct _hx_int64_and(cpp::Int64 a, cpp::Int64 b) { return a&b; }
inline cpp::Int64Struct _hx_int64_or(cpp::Int64 a, cpp::Int64 b) { return a|b; }
inline cpp::Int64Struct _hx_int64_xor(cpp::Int64 a, cpp::Int64 b) { return a^b; }
inline cpp::Int64Struct _hx_int64_shl(cpp::Int64 a, int b) { return a<<(b&63); }
inline cpp::Int64Struct _hx_int64_shr(cpp::Int64 a, int b) { return a>>(b&63); }
inline cpp::Int64Struct _hx_int64_ushr(cpp::Int64 a, int b) { return ((cpp::UInt64)a)>>(b&63); }
inline int _hx_int64_high(cpp::Int64Struct a) { return (int)( a.get() >>32 ); }
inline int _hx_int64_low(cpp::Int64Struct a) { return (int)( a.get() & 0xffffffff ); }
#endif
#endif