Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
is_utf8_continuing
// returns true if the provided byte value is a
// "continuing" UTF-8 value, that is, if it starts with
// 0b10...
static inline bool is_utf8_continuing(char c) {
// in 2 complement's notation, values start at 0b10000 (-128)... and
// go up to 0b11111 (-1)... so we want all values from -128 to -65 (which is 0b10111111)
return ((signed char)c) <= -65;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment