Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: utf8-encode

From: rpgwriter:yah:oo at: 7-Jun-2002 9:26

--- RebOldes <[oliva--david--seznam--cz]> wrote:
> shift: func [ > "Takes a base-2 binary string and shifts bits" > data [string! binary!] places [integer!] /left > /right > ][ > data: enbase/base data 2 > either right [ > remove/part tail data negate places > data: head insert/dup head data #"0" places > ][ > remove/part data places > insert/dup tail data #"0" places > ] > return debase/base data 2 > ]
Why convert to a binary string? Why not something like: shift: func [ "shifts bits in an integer, by default to the right" data [integer!] places [integer!] /right /left ] [ return data * ( 2 ** either left [ places ] [ 0 - places ] ]