aboutsummaryrefslogtreecommitdiff
path: root/sys/libunicode/internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/libunicode/internal.h')
-rw-r--r--sys/libunicode/internal.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/libunicode/internal.h b/sys/libunicode/internal.h
index bf376b2..31ed2ae 100644
--- a/sys/libunicode/internal.h
+++ b/sys/libunicode/internal.h
@@ -4,8 +4,18 @@
#include <base.h>
#include <libunicode.h>
+/* UTF-8 code
+ * 1 byte:
+ * 0xxxxxxx
+ * 2 byte:
+ * 110xxxxx 10xxxxxx
+ * 3 byte:
+ * 1110xxxx 10xxxxxx 10xxxxxx
+ * 4 byte:
+ * 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
+ */
#define Bit(i) (7-(i))
-/* N 0's preceded by i 1's e.g. T(Bit(2)) is 1100 0000 */
+/* 0's preceded by i 1's e.g. T(Bit(2)) is 1100 0000 */
#define Tbyte(i) (((1 << (Bit(i)+1))-1) ^ 0xFF)
/* 0000 0000 0000 0111 1111 1111 */
#define RuneX(i) ((1 << (Bit(i) + ((i)-1)*Bitx))-1)