summaryrefslogtreecommitdiffstats
path: root/scintilla/src/UnicodeFromUTF8.h
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@users.sourceforge.net>2013-07-15 18:57:42 +0300
committerXhmikosR <xhmikosr@users.sourceforge.net>2013-07-18 05:20:16 +0300
commit4064119f44e17baf01cc4a00a5062d173965e86c (patch)
treea6fab3caacb3d26c53bd472a1add87cf7895e58c /scintilla/src/UnicodeFromUTF8.h
parent12e4cc85f793ec12c58074359bc53724dbf43ff3 (diff)
downloadnotepad2-mod-4064119f44e17baf01cc4a00a5062d173965e86c.zip
notepad2-mod-4064119f44e17baf01cc4a00a5062d173965e86c.tar.gz
notepad2-mod-4064119f44e17baf01cc4a00a5062d173965e86c.tar.bz2
update Scintilla to v3.3.4 [e074c3]
Diffstat (limited to 'scintilla/src/UnicodeFromUTF8.h')
-rw-r--r--scintilla/src/UnicodeFromUTF8.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/scintilla/src/UnicodeFromUTF8.h b/scintilla/src/UnicodeFromUTF8.h
new file mode 100644
index 0000000..24517e8
--- /dev/null
+++ b/scintilla/src/UnicodeFromUTF8.h
@@ -0,0 +1,19 @@
+// Scintilla source code edit control
+/** @file UnicodeFromUTF8.h
+ ** Lexer infrastructure.
+ **/
+// Copyright 2013 by Neil Hodgson <neilh@scintilla.org>
+// This file is in the public domain.
+
+inline int UnicodeFromUTF8(const unsigned char *us) {
+ if (us[0] < 0xC2) {
+ return us[0];
+ } else if (us[0] < 0xE0) {
+ return ((us[0] & 0x1F) << 6) + (us[1] & 0x3F);
+ } else if (us[0] < 0xF0) {
+ return ((us[0] & 0xF) << 12) + ((us[1] & 0x3F) << 6) + (us[2] & 0x3F);
+ } else if (us[0] < 0xF5) {
+ return ((us[0] & 0x7) << 18) + ((us[1] & 0x3F) << 12) + ((us[2] & 0x3F) << 6) + (us[3] & 0x3F);
+ }
+ return us[0];
+}