diff options
author | Hans Hagen <pragma@wxs.nl> | 2016-10-19 23:19:58 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2016-10-19 23:19:58 +0200 |
commit | 9e2c13b12ff90635be145c6c02e21d6e9583037f (patch) | |
tree | aa2dded4f0c97347381d72299cf93b6c3e4b80dd /tex/context/base/mkiv/util-sac.lua | |
parent | d273e996892fcf539d67c9548c90d96c2877507a (diff) | |
download | context-9e2c13b12ff90635be145c6c02e21d6e9583037f.tar.gz |
2016-10-19 22:59:00
Diffstat (limited to 'tex/context/base/mkiv/util-sac.lua')
-rw-r--r-- | tex/context/base/mkiv/util-sac.lua | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/tex/context/base/mkiv/util-sac.lua b/tex/context/base/mkiv/util-sac.lua index 8a12e7cf0..5d16be3ec 100644 --- a/tex/context/base/mkiv/util-sac.lua +++ b/tex/context/base/mkiv/util-sac.lua @@ -10,7 +10,7 @@ if not modules then modules = { } end modules ['util-sac'] = { -- with bytes) local byte, sub = string.byte, string.sub -local extract = bit32.extract +local extract = bit32 and bit32.extract utilities = utilities or { } local streams = { } @@ -177,20 +177,24 @@ function streams.readfixed4(f) end end -function streams.read2dot14(f) - local i = f[2] - local j = i + 1 - f[2] = j + 1 - local a, b = byte(f[1],i,j) - local n = 0x100 * a + b - local m = extract(n,0,30) - if n > 0x7FFF then - n = extract(n,30,2) - return m/0x4000 - 4 - else - n = extract(n,30,2) - return n + m/0x4000 +if extract then + + function streams.read2dot14(f) + local i = f[2] + local j = i + 1 + f[2] = j + 1 + local a, b = byte(f[1],i,j) + local n = 0x100 * a + b + local m = extract(n,0,30) + if n > 0x7FFF then + n = extract(n,30,2) + return m/0x4000 - 4 + else + n = extract(n,30,2) + return n + m/0x4000 + end end + end function streams.skipshort(f,n) |