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

Bit-shift operators

 [1/2] from: ft:infologic at: 21-Feb-2006 13:48


Dear REBOListers, Are bit-shift operators available in REBOL, to shift (signed and unsigned) integers to the right or left ? More specifically, I am interested in getting the bytes of an integer (16 or 32 bits) in big-endian and low-endian order. Any hints ? Thanks. -- Binary/unsupported file stripped by Ecartis -- -- Type: text/x-vcard -- File: ft.vcf

 [2/2] from: greggirwin::mindspring::com at: 21-Feb-2006 6:50


Hi Fabien, FT> Are bit-shift operators available in REBOL, to shift (signed and FT> unsigned) integers to the right or left ? Not natively. FT> More specifically, I am interested in getting the bytes of an FT> integer (16 or 32 bits) in big-endian and low-endian order. If you can use a test release that has the rebcode VM in it (see REBOL.net for more info on that), there are bit ops in there, and you can easily wrap mezzanines around them. If that doesn't work for you, I have some old--and probably ugly--code here for twiddling bits with pure REBOL, but it will be very slow by comparison. If you don't need actual shift ops, you might be able to do it another way. Check out this ML thread at REBOL.org to see another approach: http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-display-message.r?m=rmlLNFJ -- Gregg