From 9a599ec459378d72708753ced8af2ea2999a8c2f Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 10 Jan 2008 16:56:32 -1000 Subject: [PATCH] add bit-banging words --- extra/math/functions/functions.factor | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/extra/math/functions/functions.factor b/extra/math/functions/functions.factor index 2c1a69a3d5..59ade44365 100755 --- a/extra/math/functions/functions.factor +++ b/extra/math/functions/functions.factor @@ -30,6 +30,11 @@ M: real sqrt 2dup >r >r >r odd? r> call r> 2/ r> each-bit ] if ; inline +: clear-bit ( x n -- y ) 2^ bitnot bitand ; foldable +: set-bit ( x n -- y ) 2^ bitor ; foldable +: bit-clear? ( x n -- ? ) 2^ bitand zero? ; foldable +: bit-set? ( x n -- ? ) bit-clear? not ; foldable + GENERIC: (^) ( x y -- z ) foldable : ^n ( z w -- z^w )