Handbook
Glossary
manipulate-bits ( offset bits step-quot -- quot shift-amount offset' bits' )
Vocabulary
classes
.
struct
.
bit-accessors
Inputs
offset
an
object
bits
an
object
step-quot
an
object
Outputs
quot
an
object
shift-amount
an
object
offset'
an
object
bits'
an
object
Definition
USING:
combinators
math
math.order
;
IN:
classes.struct.bit-accessors
::
manipulate-bits
( offset bits step-quot -- quot shift-amount offset' bits' )
offset 8
/mod
:>
( i start-bit ) start-bit bits
+
8
min
:>
end-bit start-bit end-bit
ones-between
:>
mask end-bit start-bit
-
:>
used-bits i mask start-bit step-quot
( i mask start-bit -- quot )
call-effect
used-bits i 1
+
8
*
bits used-bits
-
;
inline