ReactOS 0.4.16-dev-1063-gd722e70
anonymous_namespace{c16rtomb.cpp} Namespace Reference

Functions

void store_first_surrogate (char16_t c16, mbstate_t *ps)
 
char32_t combine_second_surrogate (char16_t c16, mbstate_t *ps)
 
constexpr bool has_surrogate (mbstate_t *ps)
 
constexpr bool is_first_surrogate (char16_t c16)
 
constexpr bool is_second_surrogate (char16_t c16)
 

Function Documentation

◆ combine_second_surrogate()

char32_t anonymous_namespace{c16rtomb.cpp}::combine_second_surrogate ( char16_t  c16,
mbstate_t ps 
)
inline

Definition at line 24 of file c16rtomb.cpp.

25 {
26 return ps->_Wchar + (c16 & ~0xdc00);
27 }

Referenced by __crt_mbstring::__c16rtomb_utf8().

◆ has_surrogate()

constexpr bool anonymous_namespace{c16rtomb.cpp}::has_surrogate ( mbstate_t ps)
inlineconstexpr

Definition at line 29 of file c16rtomb.cpp.

30 {
31 return ps->_Wchar != 0;
32 }

Referenced by __crt_mbstring::__c16rtomb_utf8().

◆ is_first_surrogate()

constexpr bool anonymous_namespace{c16rtomb.cpp}::is_first_surrogate ( char16_t  c16)
inlineconstexpr

Definition at line 34 of file c16rtomb.cpp.

35 {
36 // UTF-16 high surrogate
37 return 0xd800 <= c16 && c16 <= 0xdbff;
38 }

Referenced by __crt_mbstring::__c16rtomb_utf8().

◆ is_second_surrogate()

constexpr bool anonymous_namespace{c16rtomb.cpp}::is_second_surrogate ( char16_t  c16)
inlineconstexpr

Definition at line 40 of file c16rtomb.cpp.

41 {
42 // UTF-16 low surrogate
43 return 0xdc00 <= c16 && c16 <= 0xdfff;
44 }

Referenced by __crt_mbstring::__c16rtomb_utf8().

◆ store_first_surrogate()

void anonymous_namespace{c16rtomb.cpp}::store_first_surrogate ( char16_t  c16,
mbstate_t ps 
)
inline

Definition at line 15 of file c16rtomb.cpp.

16 {
17 // Store the first (high) surrogate masked and shifted, so that all that's left to do
18 // is to add the maksed second surrogate.
19 // Note: _Wchar is the only field used in mbstate_t for this function
20 const char32_t c32 = ((c16 & ~0xd800) << 10) + 0x10000;
21 ps->_Wchar = c32;
22 }

Referenced by __crt_mbstring::__c16rtomb_utf8().