Make bit module handle 32/64bit integer configs.
This commit is contained in:
parent
cd585ae91c
commit
0690a7d181
|
@ -169,7 +169,7 @@
|
||||||
|
|
||||||
/* Changed to long for use with integral Lua numbers. */
|
/* Changed to long for use with integral Lua numbers. */
|
||||||
#if !defined LUA_NUMBER_INTEGRAL
|
#if !defined LUA_NUMBER_INTEGRAL
|
||||||
#define LUA_INTEGER ptrdiff_t
|
#define LUA_INTEGER int
|
||||||
#else
|
#else
|
||||||
#if !defined LUA_INTEGRAL_LONGLONG
|
#if !defined LUA_INTEGRAL_LONGLONG
|
||||||
#define LUA_INTEGER int
|
#define LUA_INTEGER int
|
||||||
|
|
|
@ -10,9 +10,11 @@
|
||||||
|
|
||||||
#include "lauxlib.h"
|
#include "lauxlib.h"
|
||||||
|
|
||||||
/* FIXME: Assume size_t is an unsigned lua_Integer */
|
#if defined(LUA_UNSIGNED)
|
||||||
typedef size_t lua_UInteger;
|
typedef LUA_UNSIGNED lua_UInteger;
|
||||||
#define LUA_UINTEGER_MAX SIZE_MAX
|
#else
|
||||||
|
typedef unsigned LUA_INTEGER lua_UInteger;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Define TOBIT to get a bit value */
|
/* Define TOBIT to get a bit value */
|
||||||
#define TOBIT(L, n) \
|
#define TOBIT(L, n) \
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
| 2014-12-24 | [https://github.com/LuaDist/bitlib](https://github.com/LuaDist/bitlib), [Zeroday](https://github.com/funshine) | [Zeroday](https://github.com/funshine) | [bit.c](../../components/modules/bit.c)|
|
| 2014-12-24 | [https://github.com/LuaDist/bitlib](https://github.com/LuaDist/bitlib), [Zeroday](https://github.com/funshine) | [Zeroday](https://github.com/funshine) | [bit.c](../../components/modules/bit.c)|
|
||||||
|
|
||||||
|
|
||||||
Bit manipulation support, on 32bit integers.
|
Bit manipulation support, on the integer type used by the Lua VM. On 5.1 this
|
||||||
|
will be 32bit, whereas on 5.3 it may be either 32bit (default) or 64bit if
|
||||||
|
configured for 64bit integers.
|
||||||
|
|
||||||
## bit.arshift()
|
## bit.arshift()
|
||||||
Arithmetic right shift a number equivalent to `value >> shift` in C.
|
Arithmetic right shift a number equivalent to `value >> shift` in C.
|
||||||
|
|
Loading…
Reference in New Issue