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

[REBOL] Re: using struct! to convert values to binary! datatype

From: rebol-list2:seznam:cz at: 19-Oct-2002 10:26

Hello Gregg, Wednesday, October 16, 2002, 11:20:49 PM, you wrote: GI> Hi Oldes, GI> Excellent! Do you need to use COPY in cases where you're returning the GI> entire element, as in: GI> int-to-ui32-st: func[i][ui32-struct/value: i copy third ui32-struct] GI> Eliminating COPY, if you can, should add even a little more speed. GI> --Gregg In most cases it is needed. I was using it without copy, but I had some related bugs. Look at this example:
>> ui32-struct: make struct! [value [integer!]] none >> int-to-ui32-st: func[i][ui32-struct/value: i copy third ui32-struct] >> int-to-ui32-st 100
== #{64000000}
>> rejoin [int-to-ui32-st 1 int-to-ui32-st 2]
== #{0100000002000000}
>> int-to-ui32-st: func[i][ui32-struct/value: i third ui32-struct] >> rejoin [int-to-ui32-st 3 int-to-ui32-st 4]
== #{0400000004000000} I'm not sure, if it's not a Rebol bug, maybe it's just by design.