\r
#include "./utf8_util.h"\r
\r
-#include "../common/types.h"\r
+#include <brotli/types.h>\r
\r
#if defined(__cplusplus) || defined(c_plusplus)\r
extern "C" {\r
}\r
/* 2-byte UTF8 */\r
if (size > 1u &&\r
- (input[0] & 0xe0) == 0xc0 &&\r
- (input[1] & 0xc0) == 0x80) {\r
- *symbol = (((input[0] & 0x1f) << 6) |\r
- (input[1] & 0x3f));\r
- if (*symbol > 0x7f) {\r
+ (input[0] & 0xE0) == 0xC0 &&\r
+ (input[1] & 0xC0) == 0x80) {\r
+ *symbol = (((input[0] & 0x1F) << 6) |\r
+ (input[1] & 0x3F));\r
+ if (*symbol > 0x7F) {\r
return 2;\r
}\r
}\r
/* 3-byte UFT8 */\r
if (size > 2u &&\r
- (input[0] & 0xf0) == 0xe0 &&\r
- (input[1] & 0xc0) == 0x80 &&\r
- (input[2] & 0xc0) == 0x80) {\r
- *symbol = (((input[0] & 0x0f) << 12) |\r
- ((input[1] & 0x3f) << 6) |\r
- (input[2] & 0x3f));\r
- if (*symbol > 0x7ff) {\r
+ (input[0] & 0xF0) == 0xE0 &&\r
+ (input[1] & 0xC0) == 0x80 &&\r
+ (input[2] & 0xC0) == 0x80) {\r
+ *symbol = (((input[0] & 0x0F) << 12) |\r
+ ((input[1] & 0x3F) << 6) |\r
+ (input[2] & 0x3F));\r
+ if (*symbol > 0x7FF) {\r
return 3;\r
}\r
}\r
/* 4-byte UFT8 */\r
if (size > 3u &&\r
- (input[0] & 0xf8) == 0xf0 &&\r
- (input[1] & 0xc0) == 0x80 &&\r
- (input[2] & 0xc0) == 0x80 &&\r
- (input[3] & 0xc0) == 0x80) {\r
+ (input[0] & 0xF8) == 0xF0 &&\r
+ (input[1] & 0xC0) == 0x80 &&\r
+ (input[2] & 0xC0) == 0x80 &&\r
+ (input[3] & 0xC0) == 0x80) {\r
*symbol = (((input[0] & 0x07) << 18) |\r
- ((input[1] & 0x3f) << 12) |\r
- ((input[2] & 0x3f) << 6) |\r
- (input[3] & 0x3f));\r
- if (*symbol > 0xffff && *symbol <= 0x10ffff) {\r
+ ((input[1] & 0x3F) << 12) |\r
+ ((input[2] & 0x3F) << 6) |\r
+ (input[3] & 0x3F));\r
+ if (*symbol > 0xFFFF && *symbol <= 0x10FFFF) {\r
return 4;\r
}\r
}\r