From 5c93d43aa124b4618be99afb29846ab70e3f6216 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Tue, 4 Mar 2008 22:32:42 -0600 Subject: [PATCH] add some more bit-twiddling words --- extra/math/functions/functions.factor | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/extra/math/functions/functions.factor b/extra/math/functions/functions.factor index 59ade44365..85e07fe73f 100755 --- a/extra/math/functions/functions.factor +++ b/extra/math/functions/functions.factor @@ -34,6 +34,10 @@ M: real sqrt : set-bit ( x n -- y ) 2^ bitor ; foldable : bit-clear? ( x n -- ? ) 2^ bitand zero? ; foldable : bit-set? ( x n -- ? ) bit-clear? not ; foldable +: unmask ( x n -- ? ) bitnot bitand ; foldable +: unmask? ( x n -- ? ) unmask 0 > ; foldable +: mask ( x n -- ? ) bitand ; foldable +: mask? ( x n -- ? ) mask 0 > ; foldable GENERIC: (^) ( x y -- z ) foldable