summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/util-fil.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2016-10-19 23:19:58 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2016-10-19 23:19:58 +0200
commit9e2c13b12ff90635be145c6c02e21d6e9583037f (patch)
treeaa2dded4f0c97347381d72299cf93b6c3e4b80dd /tex/context/base/mkiv/util-fil.lua
parentd273e996892fcf539d67c9548c90d96c2877507a (diff)
downloadcontext-9e2c13b12ff90635be145c6c02e21d6e9583037f.tar.gz
2016-10-19 22:59:00
Diffstat (limited to 'tex/context/base/mkiv/util-fil.lua')
-rw-r--r--tex/context/base/mkiv/util-fil.lua26
1 files changed, 15 insertions, 11 deletions
diff --git a/tex/context/base/mkiv/util-fil.lua b/tex/context/base/mkiv/util-fil.lua
index eb054a5fd..0f9731a26 100644
--- a/tex/context/base/mkiv/util-fil.lua
+++ b/tex/context/base/mkiv/util-fil.lua
@@ -8,7 +8,7 @@ if not modules then modules = { } end modules ['util-fil'] = {
local byte = string.byte
local char = string.char
-local extract = bit32.extract
+local extract = bit32 and bit32.extract
local floor = math.floor
-- Here are a few helpers (the starting point were old ones I used for parsing
@@ -206,17 +206,21 @@ function files.readfixed4(f)
end
end
-function files.read2dot14(f)
- local a, b = byte(f:read(2),1,2)
- 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 files.read2dot14(f)
+ local a, b = byte(f:read(2),1,2)
+ 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 files.skipshort(f,n)