From 347d616d3cb26d19d9c79f8b0439712cf5f9012b Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 10 May 2017 17:56:24 +0000 Subject: context (May 9 10:39) git-svn-id: svn://tug.org/texlive/trunk@44279 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/context/base/mkiv/util-fil.lua | 30 +++++++++++++++++----- 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'Master/texmf-dist/tex/context/base/mkiv/util-fil.lua') diff --git a/Master/texmf-dist/tex/context/base/mkiv/util-fil.lua b/Master/texmf-dist/tex/context/base/mkiv/util-fil.lua index de3c999b72e..01bcd571e9a 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/util-fil.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/util-fil.lua @@ -195,23 +195,41 @@ function files.readinteger4le(f) end end +-- function files.readfixed2(f) +-- local a, b = byte(f:read(2),1,2) +-- if a >= 0x80 then +-- return (0x100 * a + b - 0x10000)/256.0 +-- else +-- return (0x100 * a + b)/256.0 +-- end +-- end + function files.readfixed2(f) local a, b = byte(f:read(2),1,2) if a >= 0x80 then - return (0x100 * a + b - 0x10000)/256.0 + return (a - 0x100) + b/0x100 else - return (0x100 * a + b)/256.0 + return (a ) + b/0x100 end end -- (real) (n>>16) + ((n&0xffff)/65536.0)) +-- function files.readfixed4(f) +-- local a, b, c, d = byte(f:read(4),1,4) +-- if a >= 0x80 then +-- return (0x1000000 * a + 0x10000 * b + 0x100 * c + d - 0x100000000)/65536.0 +-- else +-- return (0x1000000 * a + 0x10000 * b + 0x100 * c + d)/65536.0 +-- end +-- end + function files.readfixed4(f) local a, b, c, d = byte(f:read(4),1,4) if a >= 0x80 then - return (0x1000000 * a + 0x10000 * b + 0x100 * c + d - 0x100000000)/65536.0 + return (0x100 * a + b - 0x10000) + (0x100 * c + d)/0x10000 else - return (0x1000000 * a + 0x10000 * b + 0x100 * c + d)/65536.0 + return (0x100 * a + b ) + (0x100 * c + d)/0x10000 end end @@ -281,8 +299,8 @@ if fio and fio.readcardinal1 then files.readinteger2 = fio.readinteger2 files.readinteger3 = fio.readinteger3 files.readinteger4 = fio.readinteger4 - files.readfixed2 = fio.readfixed2 - files.readfixed4 = fio.readfixed4 + -- files.readfixed2 = fio.readfixed2 -- needs recent luatex + -- files.readfixed4 = fio.readfixed4 -- needs recent luatex files.read2dot14 = fio.read2dot14 files.setposition = fio.setposition files.getposition = fio.getposition -- cgit v1.2.3