-
Notifications
You must be signed in to change notification settings - Fork 21
/
bitwise.cpp
122 lines (106 loc) · 2.55 KB
/
bitwise.cpp
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
#include "pbvm.h"
// ulong Bitwise_And(ulong, ulong)
DWORD __declspec(dllexport) __stdcall Bitwise_And (vm_state *vm, DWORD arg_count){
DWORD isnull;
DWORD a1, a2;
value v;
last_vm = vm;
a1=ot_get_ulongarg(vm, &isnull);
if (isnull) a1=0;
a2=ot_get_ulongarg(vm, &isnull);
if (isnull) a2=0;
v.value=a1&a2;
v.type=pbvalue_ulong;
v.flags=0x100;
ot_set_return_val(vm, &v);
return 1;
}
DWORD __declspec(dllexport) __stdcall Bitwise_Or (vm_state *vm, DWORD arg_count){
DWORD isnull;
DWORD a1, a2;
value v;
last_vm = vm;
a1=ot_get_ulongarg(vm, &isnull);
if (isnull) a1=0;
a2=ot_get_ulongarg(vm, &isnull);
if (isnull) a2=0;
v.value=a1|a2;
v.type=pbvalue_ulong;
v.flags=0x100;
ot_set_return_val(vm, &v);
return 1;
}
DWORD __declspec(dllexport) __stdcall Bitwise_Xor (vm_state *vm, DWORD arg_count){
DWORD isnull;
DWORD a1, a2;
value v;
last_vm = vm;
a1=ot_get_ulongarg(vm, &isnull);
if (isnull) a1=0;
a2=ot_get_ulongarg(vm, &isnull);
if (isnull) a2=0;
v.value=a1^a2;
v.type=pbvalue_ulong;
v.flags=0x100;
ot_set_return_val(vm, &v);
return 1;
}
DWORD __declspec(dllexport) __stdcall Bitwise_Not (vm_state *vm, DWORD arg_count){
DWORD isnull;
DWORD a1;
value v;
last_vm = vm;
a1=ot_get_ulongarg(vm, &isnull);
if (isnull) a1=0;
v.value=~a1;
v.type=pbvalue_ulong;
v.flags=0x100;
ot_set_return_val(vm, &v);
return 1;
}
DWORD __declspec(dllexport) __stdcall Bitwise_Shift_Left (vm_state *vm, DWORD arg_count){
DWORD isnull;
DWORD a1, a2;
value v;
last_vm = vm;
a1=ot_get_ulongarg(vm, &isnull);
if (isnull) a1=0;
a2=ot_get_ulongarg(vm, &isnull);
if (isnull) a2=0;
v.value=a1<<a2;
v.type=pbvalue_ulong;
v.flags=0x100;
ot_set_return_val(vm, &v);
return 1;
}
DWORD __declspec(dllexport) __stdcall Bitwise_Shift_Right (vm_state *vm, DWORD arg_count){
DWORD isnull;
DWORD a1, a2;
value v;
last_vm = vm;
a1=ot_get_ulongarg(vm, &isnull);
if (isnull) a1=0;
a2=ot_get_ulongarg(vm, &isnull);
if (isnull) a2=0;
v.value=a1>>a2;
v.type=pbvalue_ulong;
v.flags=0x100;
ot_set_return_val(vm, &v);
return 1;
}
DWORD __declspec(dllexport) __stdcall Address (vm_state *vm, DWORD arg_count){
value v;
last_vm = vm;
value *v_value = ot_get_next_evaled_arg_no_convert(vm);
if (v_value->flags&IS_NULL){
v.value=0;
}else if(v_value->type==pbvalue_string){
v.value=v_value->value;
}else if(v_value->type==pbvalue_blob){
v.value=v_value->value+4;
}
v.type=pbvalue_ulong;
v.flags=0x100;
ot_set_return_val(vm, &v);
return 1;
}