math.bitwise: fix docs for mask and unmask (they don't return a boolean).
parent
bffeeed589
commit
ebbfa17b47
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue