: W* ( x y -- z ) * 64 bits ; inline
: symbols>flags ( symbols assoc -- flag-bits )
- [ at ] curry map
- 0 [ bitor ] reduce ;
+ '[ _ at ] map 0 [ bitor ] reduce ;
! bitfield
<PRIVATE
GENERIC: (bitfield-quot) ( spec -- quot )
M: integer (bitfield-quot) ( spec -- quot )
- [ swapd shift bitor ] curry ;
+ '[ _ shift ] ;
M: pair (bitfield-quot) ( spec -- quot )
- first2-unsafe over word? [ [ swapd execute ] dip ] [ ] ?
- [ shift bitor ] append 2curry ;
+ first2-unsafe over word? [
+ '[ _ execute _ shift ]
+ ] [
+ '[ _ _ shift ]
+ ] if ;
PRIVATE>
MACRO: bitfield ( bitspec -- )
- [ 0 ] [ (bitfield-quot) compose ] reduce ;
+ [ [ 0 ] ] [
+ [ (bitfield-quot) ] map unclip
+ [ '[ @ _ dip bitor ] ] reduce
+ ] if-empty ;
! bit-count
<PRIVATE