two questions (was Re: Uh-oh.... Anybody following WWDC?)

Dar Scott dsc at swcp.com
Mon Jun 6 15:03:42 EDT 2005


On Jun 6, 2005, at 12:47 PM, Andre Garzia wrote:

> and the thing about little endian and big endian? anyone assuming byte 
> orders and stuff like that will be doomed to the hell of debugging.

We can stop making those assumptions right now.

Untested...

function platformIsBigEndian
    return (char 1 of binaryEncode("I",1)) is null
end platformIsBigEndian

Note that some processors, maybe not that Rev is on, use a "middle 
endian" mixed approach for 32-bit integers.

Presumably, this will match the unicode (UTF16) order used by 
Revolution, but if you are paranoid you can make a similar test using 
numTochar():

-- just keyed into the mail
-- This assume unicode is some form of UTF16
function unicodeIsUTF16BE
   set the useUnicode to true
   return (char 1 of numToChar(1)) is null
end unicodeIsUTF16BE

Dar

-- 
**********************************************
     DSC (Dar Scott Consulting & Dar's Lab)
     http://www.swcp.com/dsc/
     Programming and software
**********************************************



More information about the use-livecode mailing list