[REBOL] Re: using struct! to convert values to binary! datatype
From: rotenca:telvia:it at: 17-Oct-2002 1:45
Hi,
> ;With the struct! I can do:
>
> int-to-ui32-st: func[n][third make struct! [n [integer!]] to block! n]
> t: now/time/precise loop 100000 [int-to-ui32-st 100] now/time/precise - t
> ;== 0:00:00.6
You must pay attention to the little-endian big-endian:
> int-to-ui32-st 100
== #{64000000}
>> to-hex 100
== #00000064
To-hex is more fast if you need a issue/string not a binary.
I find struct! very useful to convert external data from standard C
integer/float/double format to Rebol value.
---
Ciao
Romano