language-extensions/R/common/src/Unicode.cpp
// -------------------------------------------------------------------------------------------------
// Name: Handle2ByteUtf8
//
// Description:
//  Handles utf8 characters that are 2 bytes long.
//
Handle2ByteUtf8
Description:
Handles utf8 characters that are 2 bytes long.
Handle2ByteUtf8 Description : Handles utf8 characters that are 2 bytes long .
static inline void
Handle2ByteUtf8(const uint8_t* p, size_t char8Len, char32_t* char32, size_t* len, bool* ill)
{
	const FirstUnitInfo& fui = GetFirstUnitInfo(*p);
	State state = fui.nextState;
	if (char8Len > 1)
	{
		++p;
		*char32 = (fui.value << 6) | (*p & 0x3f);
		state = GetNextState(state + GetCharClass(*p));
	}
	if (state == State::END)
	{
		*len = TwoChar8Len;
		*ill = false;
	}
	else
	{
		*len = OneChar8Len;
		*char32 = BadChar;
		*ill = true;
	}
}
static inline void Handle2ByteUtf8 ( const uint8_t * p , size_t char8Len , char32_t * char32 , size_t * len , bool * ill ) { const FirstUnitInfo & fui = GetFirstUnitInfo ( * p ) ; State state = fui . nextState ; if ( char8Len > 1 ) { ++ p ; * char32 = ( fui . value << 6 ) | ( * p & 0x3f ) ; state = GetNextState ( state + GetCharClass ( * p ) ) ; } if ( state == State :: END ) { * len = TwoChar8Len ; * ill = false ; } else { * len = OneChar8Len ; * char32 = BadChar ; * ill = true ; } }
Name: Handle2ByteUtf8
Description:
Handles utf8 characters that are 2 bytes long.
Name : Handle2ByteUtf8 Description : Handles utf8 characters that are 2 bytes long .