UTF-16 surrogate macros

Corinna Vinschen corinna-cygwin@cygwin.com
Sun Aug 9 12:26:00 GMT 2009


On Aug  9 12:42, Andy Koppe wrote:
> w32api/winnls.h is lacking the macros for recognising UTF-16
> surrogates: IS_HIGH_SURROGATE, IS_LOW_SURROGATE, IS_SURROGATE_PAIR.
> Here's one way to define them, which avoids evaluating the characters
> twice:
> 
> #define IS_HIGH_SURROGATE(c) (((c) & 0xFC00) == 0xD800)
> #define IS_LOW_SURROGATE(c) (((c) & 0xFC00) == 0xDC00)
> #define IS_SURROGATE_PAIR(hc,lc) (IS_HIGH_SURROGATE(hc) && IS_LOW_SURROGATE(lc))

Applied.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list