From ebbfa17b476938efadab238418e9d33d3027a1b3 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Sun, 9 Feb 2014 15:36:49 -0800 Subject: [PATCH] math.bitwise: fix docs for mask and unmask (they don't return a boolean). --- basis/math/bitwise/bitwise-docs.factor | 4 ++-- basis/math/bitwise/bitwise.factor | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/basis/math/bitwise/bitwise-docs.factor b/basis/math/bitwise/bitwise-docs.factor index 882ee6f642..8600fb82be 100644 --- a/basis/math/bitwise/bitwise-docs.factor +++ b/basis/math/bitwise/bitwise-docs.factor @@ -184,7 +184,7 @@ HELP: >signed HELP: mask { $values { "x" integer } { "n" integer } - { "?" "a boolean" } + { "y" integer } } { $description "After the operation, only the bits that were set in both the mask and the original number are set." } { $examples @@ -297,7 +297,7 @@ HELP: shift-mod HELP: unmask { $values { "x" integer } { "n" integer } - { "?" "a boolean" } + { "y" integer } } { $description "Clears the bits in " { $snippet "x" } " if they are set in the mask " { $snippet "n" } "." } { $examples diff --git a/basis/math/bitwise/bitwise.factor b/basis/math/bitwise/bitwise.factor index b07e285c50..810133a958 100644 --- a/basis/math/bitwise/bitwise.factor +++ b/basis/math/bitwise/bitwise.factor @@ -10,9 +10,9 @@ IN: math.bitwise ! utilities : clear-bit ( x n -- y ) 2^ bitnot bitand ; inline : set-bit ( x n -- y ) 2^ bitor ; inline -: unmask ( x n -- ? ) bitnot bitand ; inline +: unmask ( x n -- y ) bitnot bitand ; inline : unmask? ( x n -- ? ) unmask zero? not ; inline -: mask ( x n -- ? ) bitand ; inline +: mask ( x n -- y ) bitand ; inline : mask? ( x n -- ? ) [ mask ] [ = ] bi ; inline : wrap ( m n -- m' ) 1 - bitand ; inline : on-bits ( m -- n ) dup 0 <= [ drop 0 ] [ 2^ 1 - ] if ; inline