add bit-banging words

db4
Doug Coleman 2008-01-10 16:56:32 -10:00
parent f627598905
commit 9a599ec459
1 changed files with 5 additions and 0 deletions
extra/math/functions

View File

@ -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 )