--- RebOldes <[EMAIL PROTECTED]> 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
]
]

=====


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to