Need a hand with a small C conversion

new topic     » topic index » view thread      » older message » newer message

G'day everyone,

Seeing as Euphoria doesn't have much in the way of bit shifting (well, as far as I know, anyway), could someone advise me on the best way to convert this bit of code into Euphoria?

    UTF32 X = (hi & ((1<<6) -1)) << 10 | lo & ((1<<10) -1); 
    UTF32 W = (hi >> 6) & ((1<<5) - 1); 
    UTF32 U = W + 1 ; 
    codepoint = U << 16 | X; 

The UTF32 datatype is defined as typedef unsigned __int32 UTF32; and hi and lo as UTF16 which is typedef unsigned __int16 UTF16;

The algorithms are from the Unicode Consortium http://www.unicode.org/unicode/faq/utf_bom.html#35

Kind regards,

Bruce.

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu