diff options
author | Luigi Scarso <luigi.scarso@gmail.com> | 2019-01-06 18:57:01 +0000 |
---|---|---|
committer | Luigi Scarso <luigi.scarso@gmail.com> | 2019-01-06 18:57:01 +0000 |
commit | 0c14fd18747b9f6fbbecb75ba8beef6d449c460a (patch) | |
tree | 6c60915cf22ba35f9f4fff0048ebe3a6c073662d /Build/source/texk/web2c/luatexdir/lua/liolibext.c | |
parent | 2a4260012f7ef1890dd351aabe4befd60922d5a6 (diff) |
luatex 1.09.2; r-mpost alias of mpost -restricted
git-svn-id: svn://tug.org/texlive/trunk@49614 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/lua/liolibext.c')
-rw-r--r-- | Build/source/texk/web2c/luatexdir/lua/liolibext.c | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/Build/source/texk/web2c/luatexdir/lua/liolibext.c b/Build/source/texk/web2c/luatexdir/lua/liolibext.c index 71b9b41d12c..87bddbc887e 100644 --- a/Build/source/texk/web2c/luatexdir/lua/liolibext.c +++ b/Build/source/texk/web2c/luatexdir/lua/liolibext.c @@ -629,16 +629,18 @@ static int readintegertable_s(lua_State *L) { return 1; } +/* from ff */ + static int readfixed2(lua_State *L) { FILE *f = tofile(L); int a = getc(f); int b = getc(f); - if (b == EOF) + if (b == EOF) { lua_pushnil(L); - else if (a >= 0x80) - lua_pushinteger(L, (a - 0x100) + b/0x100); - else - lua_pushinteger(L, (a ) + b/0x100); + } else { + int n = 0x100 * a + b; + lua_pushnumber(L,(double) ((n>>8) + ((n&0xff)/256.0))); + } return 1; } @@ -651,10 +653,8 @@ static int readfixed2_s(lua_State *L) { } else { int a = uchar(s[p++]); int b = uchar(s[p]); - if (a >= 0x80) - lua_pushinteger(L, (a - 0x100) + b/0x100); - else - lua_pushinteger(L, (a ) + b/0x100); + int n = 0x100 * a + b; + lua_pushnumber(L,(double) ((n>>8) + ((n&0xff)/256.0))); } return 1; } @@ -665,15 +665,12 @@ static int readfixed4(lua_State *L) { int b = getc(f); int c = getc(f); int d = getc(f); - if (d == EOF) + if (d == EOF) { lua_pushnil(L); - else if (a >= 0x80) - lua_pushnumber(L, (0x100 * a + b - 0x10000) + (0x100 * c + d)/0x10000); - else - lua_pushnumber(L, (0x100 * a + b ) + (0x100 * c + d)/0x10000); - /* from ff */ - /* int n = 0x1000000 * a + 0x10000 * b + 0x100 * c + d; */ - /* lua_pushnumber(L,(real) (n>>16) + ((n&0xffff)/65536.0)); */ + } else { + int n = 0x1000000 * a + 0x10000 * b + 0x100 * c + d; + lua_pushnumber(L,(double) ((n>>16) + ((n&0xffff)/65536.0))); + } return 1; } @@ -688,10 +685,8 @@ static int readfixed4_s(lua_State *L) { int b = uchar(s[p++]); int c = uchar(s[p++]); int d = uchar(s[p]); - if (a >= 0x80) - lua_pushnumber(L, (0x100 * a + b - 0x10000) + (0x100 * c + d)/0x10000); - else - lua_pushnumber(L, (0x100 * a + b ) + (0x100 * c + d)/0x10000); + int n = 0x1000000 * a + 0x10000 * b + 0x100 * c + d; + lua_pushnumber(L,(double) ((n>>16) + ((n&0xffff)/65536.0))); } return 1; } @@ -705,7 +700,7 @@ static int read2dot14(lua_State *L) { } else { int n = 0x100 * a + b; /* from ff */ - lua_pushnumber(L,(real) ((n<<16)>>(16+14)) + ((n&0x3fff)/16384.0)); + lua_pushnumber(L,(double) (((n<<16)>>(16+14)) + ((n&0x3fff)/16384.0))); } return 1; } @@ -720,7 +715,7 @@ static int read2dot14_s(lua_State *L) { int a = uchar(s[p++]); int b = uchar(s[p]); int n = 0x100 * a + b; - lua_pushnumber(L,(real) ((n<<16)>>(16+14)) + ((n&0x3fff)/16384.0)); + lua_pushnumber(L,(double) (((n<<16)>>(16+14)) + ((n&0x3fff)/16384.0))); } return 1; } |