diff lua/luadyncall/test/test_intutils.lua @ 0:0cfcc391201f

initial from svn dyncall-1745
author Daniel Adler
date Thu, 19 Mar 2015 22:26:28 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lua/luadyncall/test/test_intutils.lua	Thu Mar 19 22:26:28 2015 +0100
@@ -0,0 +1,29 @@
+require "intutils"
+u64 = intutils.u64
+i64 = intutils.i64
+local _print = print
+
+local function print(x)
+  local mt = getmetatable(x)
+  local tostring = mt.__tostring
+  if tostring then
+    _print( tostring(x) )
+  else
+    _print(x)
+  end
+end
+
+x = u64("0x00FFFFFFFFFFFF00")
+y = u64("0xCA000000000000FE")
+z = x + y
+print(x)
+print(y)
+print(z)
+
+x = i64("0x00FFFFFFFFFFFF00")
+y = i64("0xCA000000000000FE")
+z = x + y
+print(x)
+print(y)
+print(z)
+