summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2012-06-25 14:10:00 +0200
committerHans Hagen <pragma@wxs.nl>2012-06-25 14:10:00 +0200
commitc087b683dc65ab8ac92819a1de681023331fe1ab (patch)
tree5a4f65c32d4e90454d3c99672e989ce0fa2e2aa5 /scripts
parent614f10aaaf6ed9b12ab2415915341f505fcb0667 (diff)
downloadcontext-c087b683dc65ab8ac92819a1de681023331fe1ab.tar.gz
beta 2012.06.25 14:10
Diffstat (limited to 'scripts')
-rw-r--r--scripts/context/lua/mtxrun.lua4
-rw-r--r--scripts/context/stubs/mswin/mtxrun.lua4
-rwxr-xr-xscripts/context/stubs/unix/mtxrun4
3 files changed, 6 insertions, 6 deletions
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index 4c5d10c20..1e4958e39 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -2218,11 +2218,11 @@ function number.hasbit(x, p) -- typical call: if hasbit(x, bit(3)) then ...
end
function number.setbit(x, p)
- return hasbit(x, p) and x or x + p
+ return (x % (p + p) >= p) and x or x + p
end
function number.clearbit(x, p)
- return hasbit(x, p) and x - p or x
+ return (x % (p + p) >= p) and x - p or x
end
diff --git a/scripts/context/stubs/mswin/mtxrun.lua b/scripts/context/stubs/mswin/mtxrun.lua
index 4c5d10c20..1e4958e39 100644
--- a/scripts/context/stubs/mswin/mtxrun.lua
+++ b/scripts/context/stubs/mswin/mtxrun.lua
@@ -2218,11 +2218,11 @@ function number.hasbit(x, p) -- typical call: if hasbit(x, bit(3)) then ...
end
function number.setbit(x, p)
- return hasbit(x, p) and x or x + p
+ return (x % (p + p) >= p) and x or x + p
end
function number.clearbit(x, p)
- return hasbit(x, p) and x - p or x
+ return (x % (p + p) >= p) and x - p or x
end
diff --git a/scripts/context/stubs/unix/mtxrun b/scripts/context/stubs/unix/mtxrun
index 4c5d10c20..1e4958e39 100755
--- a/scripts/context/stubs/unix/mtxrun
+++ b/scripts/context/stubs/unix/mtxrun
@@ -2218,11 +2218,11 @@ function number.hasbit(x, p) -- typical call: if hasbit(x, bit(3)) then ...
end
function number.setbit(x, p)
- return hasbit(x, p) and x or x + p
+ return (x % (p + p) >= p) and x or x + p
end
function number.clearbit(x, p)
- return hasbit(x, p) and x - p or x
+ return (x % (p + p) >= p) and x - p or x
end