From: John M. S. <sk...@oz...> - 2003-06-23 03:25:13
|
Yamagata Yoriyuki wrote: > let add_uchar buf u = > let masq = 0b111111 in > let k = int_of_uchar u in > if k < 0 || k >= 0x4000000 then begin > Buffer.add_char buf (Char.chr (0xfc + (k lsr 30))); > Buffer.add_char buf (Char.unsafe_chr (0x80 lor ((k lsr 24) land masq))); You might try replacing 'masq' with the actual literal value, though the compiler should be able to determine its a constant, it may not. The other thing to do here is reorder the tests: test k>=0 && k<=07f first, then k<=07ff ..., reason being that the first case is 99.99% of cases. The second is 99.99% of the rest of cases. -- John Max Skaller, mailto:sk...@oz... snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia. voice:61-2-9660-0850 |