Implemented BGA's UTF-8 char len suggestion in UTF8.h and used it in

BString::CountChars().


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1932 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
ejakowatz
2002-11-14 08:06:18 +00:00
parent 2a86e17450
commit 8f1a4e7f89
2 changed files with 13 additions and 1 deletions
+9
View File
@@ -61,6 +61,15 @@ _IMPEXP_TEXTENCODING status_t convert_from_utf8(uint32 dstEncoding,
int32 *state,
char substitute = B_SUBSTITUTE);
/*-------------------------------------------------------------*/
/*------- Utility Functions -----------------------------------*/
// Suggested by BGA
inline uint32 utf8_char_len(uchar c)
{
return (((0xE5000000 >> (((c) >> 3) & 0x1E)) & 3) + 1);
}
/*-------------------------------------------------------------*/
/*-------------------------------------------------------------*/