annotate lua/luadyncall/test/test_intutils.lua @ 52:c5ca08cd3e78

- readme typos
author Tassilo Philipp
date Fri, 22 Jan 2021 15:12:34 +0100
parents 0cfcc391201f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
1 require "intutils"
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
2 u64 = intutils.u64
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
3 i64 = intutils.i64
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
4 local _print = print
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
5
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
6 local function print(x)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
7 local mt = getmetatable(x)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
8 local tostring = mt.__tostring
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
9 if tostring then
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
10 _print( tostring(x) )
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
11 else
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
12 _print(x)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
13 end
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
14 end
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
15
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
16 x = u64("0x00FFFFFFFFFFFF00")
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
17 y = u64("0xCA000000000000FE")
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
18 z = x + y
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
19 print(x)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
20 print(y)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
21 print(z)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
22
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
23 x = i64("0x00FFFFFFFFFFFF00")
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
24 y = i64("0xCA000000000000FE")
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
25 z = x + y
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
26 print(x)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
27 print(y)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
28 print(z)
0cfcc391201f initial from svn dyncall-1745
Daniel Adler
parents:
diff changeset
29