diff options
Diffstat (limited to 'tex/context/base/l-number.lua')
-rw-r--r-- | tex/context/base/l-number.lua | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/tex/context/base/l-number.lua b/tex/context/base/l-number.lua index a4dbe3bdf..b1ffb9ca9 100644 --- a/tex/context/base/l-number.lua +++ b/tex/context/base/l-number.lua @@ -8,7 +8,7 @@ if not modules then modules = { } end modules ['l-number'] = { -- this module will be replaced when we have the bit library -local tostring, tonumber = tostring, tonumber +local tostring = tostring local format, floor, match, rep = string.format, math.floor, string.match, string.rep local concat, insert = table.concat, table.insert local lpegmatch = lpeg.match @@ -72,11 +72,11 @@ function number.hasbit(x, p) -- typical call: if hasbit(x, bit(3)) then ... end function number.setbit(x, p) - return (x % (p + p) >= p) and x or x + p + return hasbit(x, p) and x or x + p end function number.clearbit(x, p) - return (x % (p + p) >= p) and x - p or x + return hasbit(x, p) and x - p or x end --~ function number.tobitstring(n) @@ -128,7 +128,3 @@ end --~ print(number.tobitstring(0xFF)) --~ print(number.tobitstring(46260767936,8)) --~ print(#number.tobitstring(46260767936,6)) - -function number.valid(str,default) - return tonumber(str) or default or nil -end |