|
@@ -31,6 +31,10 @@ class Boot {
|
|
|
static var _:Dynamic;
|
|
|
static var _fid = 0;
|
|
|
|
|
|
+ static var Max_Int32 = 2147483647;
|
|
|
+ static var Min_Int32 = -2147483648;
|
|
|
+
|
|
|
+
|
|
|
// A max stack size to respect for unpack operations
|
|
|
public static var MAXSTACKSIZE(default, null) = 1000;
|
|
|
|
|
@@ -90,7 +94,7 @@ class Boot {
|
|
|
|
|
|
switch (cl) {
|
|
|
case Int:
|
|
|
- return (Lua.type(o) == "number" && clamp(o) == o);
|
|
|
+ return (Lua.type(o) == "number" && clampInt32(o) == o);
|
|
|
case Float:
|
|
|
return Lua.type(o) == "number";
|
|
|
case Bool:
|
|
@@ -297,8 +301,18 @@ class Boot {
|
|
|
/**
|
|
|
A 32 bit clamp function for numbers
|
|
|
**/
|
|
|
- public inline static function clamp(x:Float) {
|
|
|
+ public inline static function clampInt32(x:Float) {
|
|
|
+#if lua_vanilla
|
|
|
+ if (x < Min_Int32 ) {
|
|
|
+ return Min_Int32;
|
|
|
+ } else if (x > Max_Int32) {
|
|
|
+ return Max_Int32;
|
|
|
+ } else {
|
|
|
+ return Math.floor(x);
|
|
|
+ }
|
|
|
+#else
|
|
|
return untyped __define_feature__("lua.Boot.clamp", _hx_bit_clamp(x));
|
|
|
+#end
|
|
|
}
|
|
|
|
|
|
/**
|