7 lines
403 B
Forth
7 lines
403 B
Forth
// Unicode character point to UTF8. Nigel Galloway: March 19th., 2018
|
|
let fN g = match List.findIndex (fun n->n>g) [0x80;0x800;0x10000;0x110000] with
|
|
|0->[g]
|
|
|1->[0xc0+(g&&&0x7c0>>>6);0x80+(g&&&0x3f)]
|
|
|2->[0xe0+(g&&&0xf000>>>12);0x80+(g&&&0xfc0>>>6);0x80+(g&&&0x3f)]
|
|
|_->[0xf0+(g&&&0x1c0000>>>18);0x80+(g&&&0x3f000>>>12);0x80+(g&&&0xfc0>>>6);0x80+(g&&&0x3f)]
|