File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed
Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -13,3 +13,28 @@ S32 GetUTF8CharBytes(const S8* a1)
1313 }
1414 return 1 ;
1515}
16+
17+ U32 GetUTF8CharCode (const S8* a1)
18+ {
19+ const U8 *p = (const U8*)a1;
20+ char v1 = *p;
21+
22+ if ((v1 & 0x80 ) == 0 )
23+ {
24+ return p[0 ];
25+ }
26+ else if ((v1 & 0xE0 ) == 0xC0 )
27+ {
28+ return ((p[0 ] & 0xff ) << 8 ) | (p[1 ] & 0xff );
29+ }
30+ else if ((v1 & 0xF0 ) == 0xE0 )
31+ {
32+ return ((p[0 ] & 0xff ) << 16 ) | ((p[1 ] & 0xff ) << 8 ) | (p[2 ] & 0xff );
33+ }
34+ else if ((v1 & 0xF8 ) == 0xF0 )
35+ {
36+ return ((p[0 ] & 0xff ) << 24 ) | ((p[1 ] & 0xff ) << 16 ) | ((p[2 ] & 0xff ) << 8 ) | (p[3 ] & 0xff );
37+ }
38+
39+ return 1 ;
40+ }
Original file line number Diff line number Diff line change 33#include "Types_Z.h"
44
55S32 GetUTF8CharBytes (const S8 * a1 );
6-
6+ U32 GetUTF8CharCode ( const S8 * a1 );
77#endif
You can’t perform that action at this time.
0 commit comments