annotate lib/lua/lua-5.2.2/lbitlib.c @ 1996:f7e8c4d4a01b

sound id fix
author zipi
date Sun, 03 Nov 2013 14:29:45 +0000
parents 41cc4dd3c122
children
rev   line source
1866
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
1 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
2 ** $Id: lbitlib.c,v 1.18 2013/03/19 13:19:12 roberto Exp $
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
3 ** Standard library for bitwise operations
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
4 ** See Copyright Notice in lua.h
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
5 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
6
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
7 #define lbitlib_c
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
8 #define LUA_LIB
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
9
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
10 #include "lua.h"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
11
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
12 #include "lauxlib.h"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
13 #include "lualib.h"
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
14
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
15
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
16 /* number of bits to consider in a number */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
17 #if !defined(LUA_NBITS)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
18 #define LUA_NBITS 32
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
19 #endif
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
20
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
21
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
22 #define ALLONES (~(((~(lua_Unsigned)0) << (LUA_NBITS - 1)) << 1))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
23
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
24 /* macro to trim extra bits */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
25 #define trim(x) ((x) & ALLONES)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
26
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
27
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
28 /* builds a number with 'n' ones (1 <= n <= LUA_NBITS) */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
29 #define mask(n) (~((ALLONES << 1) << ((n) - 1)))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
30
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
31
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
32 typedef lua_Unsigned b_uint;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
33
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
34
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
35
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
36 static b_uint andaux (lua_State *L) {
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
37 int i, n = lua_gettop(L);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
38 b_uint r = ~(b_uint)0;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
39 for (i = 1; i <= n; i++)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
40 r &= luaL_checkunsigned(L, i);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
41 return trim(r);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
42 }
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
43
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
44
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
45 static int b_and (lua_State *L) {
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
46 b_uint r = andaux(L);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
47 lua_pushunsigned(L, r);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
48 return 1;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
49 }
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
50
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
51
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
52 static int b_test (lua_State *L) {
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
53 b_uint r = andaux(L);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
54 lua_pushboolean(L, r != 0);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
55 return 1;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
56 }
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
57
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
58
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
59 static int b_or (lua_State *L) {
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
60 int i, n = lua_gettop(L);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
61 b_uint r = 0;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
62 for (i = 1; i <= n; i++)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
63 r |= luaL_checkunsigned(L, i);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
64 lua_pushunsigned(L, trim(r));
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
65 return 1;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
66 }
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
67
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
68
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
69 static int b_xor (lua_State *L) {
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
70 int i, n = lua_gettop(L);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
71 b_uint r = 0;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
72 for (i = 1; i <= n; i++)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
73 r ^= luaL_checkunsigned(L, i);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
74 lua_pushunsigned(L, trim(r));
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
75 return 1;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
76 }
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
77
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
78
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
79 static int b_not (lua_State *L) {
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
80 b_uint r = ~luaL_checkunsigned(L, 1);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
81 lua_pushunsigned(L, trim(r));
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
82 return 1;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
83 }
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
84
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
85
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
86 static int b_shift (lua_State *L, b_uint r, int i) {
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
87 if (i < 0) { /* shift right? */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
88 i = -i;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
89 r = trim(r);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
90 if (i >= LUA_NBITS) r = 0;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
91 else r >>= i;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
92 }
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
93 else { /* shift left */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
94 if (i >= LUA_NBITS) r = 0;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
95 else r <<= i;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
96 r = trim(r);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
97 }
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
98 lua_pushunsigned(L, r);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
99 return 1;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
100 }
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
101
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
102
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
103 static int b_lshift (lua_State *L) {
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
104 return b_shift(L, luaL_checkunsigned(L, 1), luaL_checkint(L, 2));
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
105 }
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
106
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
107
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
108 static int b_rshift (lua_State *L) {
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
109 return b_shift(L, luaL_checkunsigned(L, 1), -luaL_checkint(L, 2));
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
110 }
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
111
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
112
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
113 static int b_arshift (lua_State *L) {
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
114 b_uint r = luaL_checkunsigned(L, 1);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
115 int i = luaL_checkint(L, 2);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
116 if (i < 0 || !(r & ((b_uint)1 << (LUA_NBITS - 1))))
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
117 return b_shift(L, r, -i);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
118 else { /* arithmetic shift for 'negative' number */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
119 if (i >= LUA_NBITS) r = ALLONES;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
120 else
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
121 r = trim((r >> i) | ~(~(b_uint)0 >> i)); /* add signal bit */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
122 lua_pushunsigned(L, r);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
123 return 1;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
124 }
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
125 }
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
126
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
127
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
128 static int b_rot (lua_State *L, int i) {
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
129 b_uint r = luaL_checkunsigned(L, 1);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
130 i &= (LUA_NBITS - 1); /* i = i % NBITS */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
131 r = trim(r);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
132 r = (r << i) | (r >> (LUA_NBITS - i));
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
133 lua_pushunsigned(L, trim(r));
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
134 return 1;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
135 }
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
136
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
137
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
138 static int b_lrot (lua_State *L) {
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
139 return b_rot(L, luaL_checkint(L, 2));
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
140 }
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
141
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
142
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
143 static int b_rrot (lua_State *L) {
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
144 return b_rot(L, -luaL_checkint(L, 2));
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
145 }
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
146
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
147
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
148 /*
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
149 ** get field and width arguments for field-manipulation functions,
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
150 ** checking whether they are valid.
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
151 ** ('luaL_error' called without 'return' to avoid later warnings about
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
152 ** 'width' being used uninitialized.)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
153 */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
154 static int fieldargs (lua_State *L, int farg, int *width) {
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
155 int f = luaL_checkint(L, farg);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
156 int w = luaL_optint(L, farg + 1, 1);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
157 luaL_argcheck(L, 0 <= f, farg, "field cannot be negative");
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
158 luaL_argcheck(L, 0 < w, farg + 1, "width must be positive");
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
159 if (f + w > LUA_NBITS)
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
160 luaL_error(L, "trying to access non-existent bits");
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
161 *width = w;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
162 return f;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
163 }
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
164
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
165
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
166 static int b_extract (lua_State *L) {
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
167 int w;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
168 b_uint r = luaL_checkunsigned(L, 1);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
169 int f = fieldargs(L, 2, &w);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
170 r = (r >> f) & mask(w);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
171 lua_pushunsigned(L, r);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
172 return 1;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
173 }
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
174
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
175
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
176 static int b_replace (lua_State *L) {
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
177 int w;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
178 b_uint r = luaL_checkunsigned(L, 1);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
179 b_uint v = luaL_checkunsigned(L, 2);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
180 int f = fieldargs(L, 3, &w);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
181 int m = mask(w);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
182 v &= m; /* erase bits outside given width */
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
183 r = (r & ~(m << f)) | (v << f);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
184 lua_pushunsigned(L, r);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
185 return 1;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
186 }
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
187
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
188
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
189 static const luaL_Reg bitlib[] = {
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
190 {"arshift", b_arshift},
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
191 {"band", b_and},
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
192 {"bnot", b_not},
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
193 {"bor", b_or},
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
194 {"bxor", b_xor},
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
195 {"btest", b_test},
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
196 {"extract", b_extract},
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
197 {"lrotate", b_lrot},
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
198 {"lshift", b_lshift},
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
199 {"replace", b_replace},
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
200 {"rrotate", b_rrot},
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
201 {"rshift", b_rshift},
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
202 {NULL, NULL}
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
203 };
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
204
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
205
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
206
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
207 LUAMOD_API int luaopen_bit32 (lua_State *L) {
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
208 luaL_newlib(L, bitlib);
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
209 return 1;
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
210 }
41cc4dd3c122 Lua 5.2.2 added.
Nomad
parents:
diff changeset
211