mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-10 21:16:24 +02:00
Minor optimization/cleanup
This commit is contained in:
1 parent
4ec1e2a175
commit
cdb830f390
5 files changed
+11
-22
No files matched your search
@@ -219,19 +219,14 @@ int u8_strlen(const char *s)
|
||||
}
|
||||
|
||||
/* reads the next utf-8 sequence out of a string, updating an index */
|
||||
uint32_t u8_nextchar(const char *s, int *i)
|
||||
{
|
||||
uint32_t ch = 0;
|
||||
int sz = 0;
|
||||
|
||||
do {
|
||||
ch <<= 6;
|
||||
ch += (unsigned char)s[(*i)++];
|
||||
sz++;
|
||||
} while (s[*i] && !isutf(s[*i]));
|
||||
ch -= offsetsFromUTF8[sz-1];
|
||||
|
||||
return ch;
|
||||
uint32_t u8_nextchar(const char *s, int *i) {
|
||||
uint32_t ch = 0;
|
||||
int sz = 0;
|
||||
do {
|
||||
ch = (ch << 6) + (unsigned char)s[(*i)++];
|
||||
sz++;
|
||||
} while (s[*i] && ((s[*i]) & 0xC0) == 0x80);
|
||||
return ch - offsetsFromUTF8[sz - 1];
|
||||
}
|
||||
|
||||
uint32_t u8_nextchar_unsafe(const char *s, int *i) {
|
||||
|
||||
Reference in new issue
Block a user