Hello all. :)
So far, it has taken me a lot of time to manage the decoding of a protocol (named ASTERIX) using Rebol while the rest of the code was quite simple ...
Problems I encountered are :
- How do logic operators exactly work on binary data?
>> and #{000F} #{03}
== #{000F}
I would have expected as a result #{0003} .... seems in fact that the operator was applied only on the "first" byte, is this asumption correct?
- How can I simply write an "AND" operation between an integer and a binary!
Tried the to-hex function but no luck, result is an issue! and "AND" fails. :(
What exaclty is an issue!? shouldn't the result have more meaning as a binary!?
Also, trying to "convert" an integer in binary form, I fell on another problem, as to-binary in fact converts first the integer in string form before conversion in binary ...
The only solution I found was to use a trick which is I suppose totally platform-dependant :
bin: reverse third make struct! [i [int]] reduce [my-int-value]
This far, I am crying to get a pack/unpack system equivalent to the ruby one as these problems only hide other ones when I will have to extract 3 bits from a 24 bits word ....
So my question now :o)
As anyone already developped anything related to byte/bit manipulation?
Thanks by advance.
Juan-Carlos