Hi Jerry, Dave

Thanks for jumping in Jerry.  But your function below does not do the *same
thing* as mine:

to-2byte: func [int [integer!]][
     head reverse do join "#{" [(copy skip (to-string to-hex int) 4) "}"]
]

At the console

>> to-hex 8760
== #00002238
This is the pattern of hex digits for a 4-byte non-reversed integer value of
8760.

>> to-2byte 8760
== #{3822}
This is my result which is the correct 2-byte byte-reversed binary value.

>> byter 8760
== #{00003822}
This is the result from your function. It is a 4-byte binary value.
However, only the 2-least significant bytes are reversed.

The correct 4-byte byte-reversed value is:
#{38220000}
All four bytes are reversed.

Larry :-)


----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, December 07, 1999 3:02 PM
Subject: [REBOL] Newbie seeks help Re:(3)


> Dave,
>
> Just for fun I wrote another way of doing the same thing:
>
> byter: func [n [integer!]]
> [do join "#{" [to-hex (256 * (n // 256)) + to-integer (n / 256) "}"]]
>
> Jerry
>

Reply via email to