diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/l-number.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/l-number.lua | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/l-number.lua b/Master/texmf-dist/tex/context/base/mkiv/l-number.lua index 9fd2f82f785..a83e8f8f94a 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/l-number.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/l-number.lua @@ -81,14 +81,13 @@ if bit32 then "0", "0", "0", "0", "0", "0", "0", "0", } - function number.tobitstring(b,m,w) - if not w then - w = 32 - end - local n = w - for i=0,w-1 do + function number.tobitstring(b,m) + -- if really needed we can speed this one up + -- because small numbers need less extraction + local n = 32 + for i=0,31 do local v = bextract(b,i) - local k = w - i + local k = 32 - i if v == 1 then n = k t[k] = "1" @@ -96,14 +95,12 @@ if bit32 then t[k] = "0" end end - if w then - return concat(t,"",1,w) - elseif m then + if m then m = 33 - m * 8 if m < 1 then m = 1 end - return concat(t,"",1,m) + return concat(t,"",m) elseif n < 8 then return concat(t) elseif n < 16 then @@ -235,7 +232,3 @@ function number.decimaltobyte(d) return b end end - -function number.idiv(i,d) - return floor(i/d) -- i//d in 5.3 -end |