Rebol Programming/shift

From Wikibooks, open books for an open world
Jump to navigation Jump to search

USAGE:

[edit | edit source]
SHIFT data bits /left /logical /part length 

DESCRIPTION:

[edit | edit source]

Perform a bit shift operation. Right shift (decreasing) by default.

SHIFT is a native value.

ARGUMENTS

[edit | edit source]
  • data -- (Type: integer binary)
  • bits -- Number of bits to shift (Type: integer)

REFINEMENTS

[edit | edit source]
  • /left -- Shift bits to the left (increasing)
  • /logical -- Use logical shift (unsigned, fill with zero)
  • /part -- Shift only part of a series.
    • length -- (Type: integer)

SOURCE CODE

[edit | edit source]
shift: native[
    {Perform a bit shift operation. Right shift (decreasing) by default.} 
    data [integer! binary!] 
    bits [integer!] "Number of bits to shift" 
    /left "Shift bits to the left (increasing)" 
    /logical "Use logical shift (unsigned, fill with zero)" 
    /part "Shift only part of a series." 
    length [integer!]
]