• Home
  • Raw
  • Download

Lines Matching full:local

1 local bit = require("bit")
2 local ffi = require("ffi")
3 local band = bit.band
4 local bnot = bit.bnot
7 local m = {}
8 local Uint8Bound = 256 -- bound is the max uintN + 1
9 local Uint16Bound = 65536
10 local Uint32Bound = 4294967296
25 local function pack_I1(n)
28 local function pack_i1(n)
35 local function unpack_I1(n, pos)
38 local function unpack_i1(n, pos)
39 local res = unpack_I1(n, pos)
46 local b2 = ffi.new("unsigned char[2]")
47 local function pack_I2(n)
54 local function pack_i2(n)
61 local function unpack_I2(n, pos)
62 local a, b = string.byte(n, pos, pos + 1)
65 local function unpack_i2(n, pos)
66 local res = unpack_I2(n, pos)
73 local b4 = ffi.new("unsigned char[4]")
74 local function pack_I4(n)
81 local function pack_i4(n)
88 local function unpack_I4(n, pos)
89 local a, b, c, d = string.byte(n, pos, pos + 3)
92 local function unpack_i4(n, pos)
93 local res = unpack_I4(n, pos)
100 local b8 = ffi.new("unsigned char[8]")
101 local function pack_I8(n)
103 local hi = math.floor(tonumber(n / Uint32Bound))
104 local li = n % Uint32Bound
115 local function pack_i8(n)
120 local function unpack_I8(n, pos)
121 local a, b, c, d = string.byte(n, pos, pos + 3)
122 local li = Uint8Bound * (Uint8Bound * ((Uint8Bound * d) + c) + b) + a
123 local a, b, c, d = string.byte(n, pos + 4, pos + 7)
124 local hi = Uint8Bound * (Uint8Bound * ((Uint8Bound * d) + c) + b) + a
127 local function unpack_i8(n, pos)
128 local res = unpack_I8(n, pos)
132 local bf = ffi.new("float[1]")
133 local function pack_f(n)
138 local function unpack_f(n, pos)
143 local bd = ffi.new("double[1]")
144 local function pack_d(n)
149 local function unpack_d(n, pos)