From beda479a1479a421db0149be29edac038eec1f90 Mon Sep 17 00:00:00 2001 From: Boris Nagaev Date: Mon, 13 Jun 2016 14:27:12 +0300 Subject: [PATCH] add contant: luahs.UINT_MAX --- spec/constants_spec.lua | 1 + src/luahs/constants.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/spec/constants_spec.lua b/spec/constants_spec.lua index 443652e..d0ef4c9 100644 --- a/spec/constants_spec.lua +++ b/spec/constants_spec.lua @@ -13,6 +13,7 @@ describe("constants", function() assert.equal(4, luahs.cpu_features.HS_CPU_FEATURES_AVX2) assert.equal(2, luahs.cpu_tuning.HS_TUNE_FAMILY_IVB) assert.equal(-1, luahs.HS_OFFSET_PAST_HORIZON) + assert.truthy(luahs.UINT_MAX > 0) end) it("decodes constants", function() diff --git a/src/luahs/constants.c b/src/luahs/constants.c index 561655e..5c24184 100644 --- a/src/luahs/constants.c +++ b/src/luahs/constants.c @@ -2,6 +2,8 @@ // Copyright (C) 2016 Boris Nagaev // See the LICENSE file for terms of use. +#include + #include "luahs.h" typedef struct luahs_Constant { @@ -160,4 +162,6 @@ void luahs_addConstants(lua_State* L) { lua_setfield(L, -2, "decodeError"); lua_pushinteger(L, HS_OFFSET_PAST_HORIZON); lua_setfield(L, -2, "HS_OFFSET_PAST_HORIZON"); + lua_pushinteger(L, UINT_MAX); + lua_setfield(L, -2, "UINT_MAX"); }