[HarfBuzz] harfbuzz: Branch 'master' - 7 commits

Behdad Esfahbod behdad at kemper.freedesktop.org
Fri Jul 11 13:24:43 PDT 2014


 src/gen-arabic-table.py                    |   18 -
 src/gen-indic-table.py                     |   10 
 src/hb-buffer-serialize.cc                 |    2 
 src/hb-common.cc                           |    4 
 src/hb-coretext.cc                         |   16 -
 src/hb-open-file-private.hh                |    4 
 src/hb-open-type-private.hh                |    2 
 src/hb-ot-cmap-table.hh                    |    4 
 src/hb-ot-head-table.hh                    |    6 
 src/hb-ot-hhea-table.hh                    |    2 
 src/hb-ot-layout-common-private.hh         |   14 
 src/hb-ot-layout-gdef-table.hh             |    8 
 src/hb-ot-layout-gpos-table.hh             |   24 -
 src/hb-ot-layout-gsub-table.hh             |    6 
 src/hb-ot-layout-gsubgpos-private.hh       |    2 
 src/hb-ot-layout-jstf-table.hh             |    2 
 src/hb-ot-layout-private.hh                |    4 
 src/hb-ot-layout.h                         |    6 
 src/hb-ot-map-private.hh                   |    8 
 src/hb-ot-maxp-table.hh                    |    4 
 src/hb-ot-shape-complex-arabic-fallback.hh |    2 
 src/hb-ot-shape-complex-arabic-table.hh    |  420 ++++++++++++++---------------
 src/hb-ot-shape-complex-hangul.cc          |   36 +-
 src/hb-ot-shape-complex-hebrew.cc          |  134 ++++-----
 src/hb-ot-shape-complex-indic-table.cc     |   88 +++---
 src/hb-ot-shape-complex-indic.cc           |  182 ++++++------
 src/hb-ot-shape-complex-myanmar.cc         |   56 +--
 src/hb-ot-shape-complex-sea.cc             |    8 
 src/hb-ot-shape-complex-thai.cc            |   84 ++---
 src/hb-ot-shape-fallback.cc                |   40 +-
 src/hb-ot-shape-normalize.cc               |    2 
 src/hb-ot-shape.cc                         |    6 
 src/hb-ot-tag.cc                           |   18 -
 src/hb-private.hh                          |   16 -
 src/hb-unicode-private.hh                  |   40 +-
 src/hb-uniscribe.cc                        |   14 
 src/hb-utf-private.hh                      |  147 +++++-----
 test/api/test-buffer.c                     |    9 
 38 files changed, 726 insertions(+), 722 deletions(-)

New commits:
commit b7bc0b671d2d568cb64b647dad2ca866a4e0183b
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Jul 11 16:20:28 2014 -0400

    Simplify / speed up UTF-8 code

diff --git a/src/hb-utf-private.hh b/src/hb-utf-private.hh
index 4c4fce1..a4c6236 100644
--- a/src/hb-utf-private.hh
+++ b/src/hb-utf-private.hh
@@ -62,13 +62,11 @@ hb_utf_next (const uint8_t *text,
       unsigned int t1, t2;
       if (likely (1 < end - text &&
 		  (t1 = text[0] - 0x80u) <= 0x3Fu &&
-		  (t2 = text[1] - 0x80u) <= 0x3Fu &&
-		  (hb_in_range (c, 0xE1u, 0xECu) ||
-		   hb_in_range (c, 0xEEu, 0xEFu) ||
-		   (c == 0xE0u && t1 >= 0xA0u-0x80u) ||
-		   (c == 0xEDu && t1 <= 0x9Fu-0x80u))))
+		  (t2 = text[1] - 0x80u) <= 0x3Fu))
       {
 	c = ((c&0xFu)<<12) | (t1<<6) | t2;
+	if (unlikely (c < 0x0800u || hb_in_range (c, 0xD800u, 0xDFFFu)))
+	  goto error;
 	text += 2;
       }
       else
@@ -80,12 +78,11 @@ hb_utf_next (const uint8_t *text,
       if (likely (2 < end - text &&
 		  (t1 = text[0] - 0x80u) <= 0x3Fu &&
 		  (t2 = text[1] - 0x80u) <= 0x3Fu &&
-		  (t3 = text[2] - 0x80u) <= 0x3Fu &&
-		  (hb_in_range (c, 0xF1u, 0xF3u) ||
-		   (c == 0xF0u && t1 >= 0x90u-0x80u) ||
-		   (c == 0xF4u && t1 <= 0x8Fu-0x80u))))
+		  (t3 = text[2] - 0x80u) <= 0x3Fu))
       {
 	c = ((c&0x7u)<<18) | (t1<<12) | (t2<<6) | t3;
+	if (unlikely (!hb_in_range (c, 0x10000u, 0x10FFFFu)))
+	  goto error;
 	text += 3;
       }
       else
commit af2490c0959daa0fe7f32a8b3b3a3699c7fc5f48
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Jul 11 16:10:58 2014 -0400

    Only accept well-formed UTF-8 sequences
    
    Enable tests that were disabled before, and adjust one test,
    and add more tests.

diff --git a/src/hb-utf-private.hh b/src/hb-utf-private.hh
index 375d3b4..4c4fce1 100644
--- a/src/hb-utf-private.hh
+++ b/src/hb-utf-private.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2011,2012  Google, Inc.
+ * Copyright © 2011,2012,2014  Google, Inc.
  *
  *  This is part of HarfBuzz, a text shaping library.
  *
@@ -32,44 +32,75 @@
 
 /* UTF-8 */
 
-#define HB_UTF8_COMPUTE(Char, Mask, Len) \
-  if (Char < 128) { Len = 1; Mask = 0x7f; } \
-  else if ((Char & 0xe0) == 0xc0) { Len = 2; Mask = 0x1f; } \
-  else if ((Char & 0xf0) == 0xe0) { Len = 3; Mask = 0x0f; } \
-  else if ((Char & 0xf8) == 0xf0) { Len = 4; Mask = 0x07; } \
-  else Len = 0;
-
 static inline const uint8_t *
 hb_utf_next (const uint8_t *text,
 	     const uint8_t *end,
 	     hb_codepoint_t *unicode)
 {
-  hb_codepoint_t c = *text, mask;
-  unsigned int len;
-
-  /* TODO check for overlong sequences? */
-
-  HB_UTF8_COMPUTE (c, mask, len);
-  if (unlikely (!len || (unsigned int) (end - text) < len)) {
-    *unicode = -1;
-    return text + 1;
-  } else {
-    hb_codepoint_t result;
-    unsigned int i;
-    result = c & mask;
-    for (i = 1; i < len; i++)
+  /* Written to only accept well-formed sequences.
+   * Based on ideas from ICU's U8_NEXT.
+   * Generates a -1 for each ill-formed byte. */
+
+  hb_codepoint_t c = *text++;
+
+  if (c > 0x7Fu)
+  {
+    if (hb_in_range (c, 0xC2u, 0xDFu)) /* Two-byte */
+    {
+      unsigned int t1;
+      if (likely (text < end &&
+		  (t1 = text[0] - 0x80u) <= 0x3Fu))
+      {
+	c = ((c&0x1Fu)<<6) | t1;
+	text++;
+      }
+      else
+	goto error;
+    }
+    else if (hb_in_range (c, 0xE0u, 0xEFu)) /* Three-byte */
+    {
+      unsigned int t1, t2;
+      if (likely (1 < end - text &&
+		  (t1 = text[0] - 0x80u) <= 0x3Fu &&
+		  (t2 = text[1] - 0x80u) <= 0x3Fu &&
+		  (hb_in_range (c, 0xE1u, 0xECu) ||
+		   hb_in_range (c, 0xEEu, 0xEFu) ||
+		   (c == 0xE0u && t1 >= 0xA0u-0x80u) ||
+		   (c == 0xEDu && t1 <= 0x9Fu-0x80u))))
       {
-	if (unlikely ((text[i] & 0xc0) != 0x80))
-	  {
-	    *unicode = -1;
-	    return text + 1;
-	  }
-	result <<= 6;
-	result |= (text[i] & 0x3f);
+	c = ((c&0xFu)<<12) | (t1<<6) | t2;
+	text += 2;
       }
-    *unicode = result;
-    return text + len;
+      else
+	goto error;
+    }
+    else if (hb_in_range (c, 0xF0u, 0xF4u)) /* Four-byte */
+    {
+      unsigned int t1, t2, t3;
+      if (likely (2 < end - text &&
+		  (t1 = text[0] - 0x80u) <= 0x3Fu &&
+		  (t2 = text[1] - 0x80u) <= 0x3Fu &&
+		  (t3 = text[2] - 0x80u) <= 0x3Fu &&
+		  (hb_in_range (c, 0xF1u, 0xF3u) ||
+		   (c == 0xF0u && t1 >= 0x90u-0x80u) ||
+		   (c == 0xF4u && t1 <= 0x8Fu-0x80u))))
+      {
+	c = ((c&0x7u)<<18) | (t1<<12) | (t2<<6) | t3;
+	text += 3;
+      }
+      else
+	goto error;
+    }
+    else
+      goto error;
   }
+
+  *unicode = c;
+  return text;
+
+error:
+  *unicode = -1;
+  return text;
 }
 
 static inline const uint8_t *
diff --git a/test/api/test-buffer.c b/test/api/test-buffer.c
index 0b70cf9..1956c92 100644
--- a/test/api/test-buffer.c
+++ b/test/api/test-buffer.c
@@ -449,11 +449,15 @@ static const utf8_validity_test_t utf8_validity_tests[] = {
   { "\x7f", -1, 1, TRUE },
   { "\xdf\xbf", -1, 2, TRUE },
   { "\xef\xbf\xbf", -1, 0, TRUE },
-  { "\xf7\xbf\xbf\xbf", -1, 0, TRUE },
+  { "\xf4\x8f\xbf\xbf", -1, 0, TRUE },
+  { "\xf4\x90\xbf\xbf", -1, 0, FALSE },
+  { "\xf7\xbf\xbf\xbf", -1, 0, FALSE },
   { "\xfb\xbf\xbf\xbf\xbf", -1, 0, FALSE },
   { "\xfd\xbf\xbf\xbf\xbf\xbf", -1, 0, FALSE },
   /* other boundary conditions */
   { "\xed\x9f\xbf", -1, 3, TRUE },
+  { "\xed\xa0\x80", -1, 0, FALSE },
+  { "\xed\xbf\xbf", -1, 0, FALSE },
   { "\xee\x80\x80", -1, 3, TRUE },
   { "\xef\xbf\xbd", -1, 3, TRUE },
   { "\xf4\x8f\xbf\xbf", -1, 0, TRUE },
@@ -610,8 +614,6 @@ static const utf8_validity_test_t utf8_validity_tests[] = {
   /* impossible bytes */
   { "\x20\xfe\x20", -1, 1, FALSE },
   { "\x20\xff\x20", -1, 1, FALSE },
-#if 0
-  /* XXX fix these, or document that we don't detect them? */
   /* overlong sequences */
   { "\x20\xc0\xaf\x20", -1, 1, FALSE },
   { "\x20\xe0\x80\xaf\x20", -1, 1, FALSE },
@@ -644,6 +646,7 @@ static const utf8_validity_test_t utf8_validity_tests[] = {
   { "\x20\xed\xae\x80\xed\xbf\xbf\x20", -1, 1, FALSE },
   { "\x20\xed\xaf\xbf\xed\xb0\x80\x20", -1, 1, FALSE },
   { "\x20\xed\xaf\xbf\xed\xbf\xbf\x20", -1, 1, FALSE },
+#if 0 /* We don't consider U+FFFE / U+FFFF and similar invalid. */
   { "\x20\xef\xbf\xbe\x20", -1, 1, FALSE },
   { "\x20\xef\xbf\xbf\x20", -1, 1, FALSE },
 #endif
commit 7323d385cc758c06671cb38239d240eb517b28bc
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Jul 11 15:10:05 2014 -0400

    Simplify hb_utf_prev<16> to call hb_utf_next<16>

diff --git a/src/hb-utf-private.hh b/src/hb-utf-private.hh
index bfb3a80..375d3b4 100644
--- a/src/hb-utf-private.hh
+++ b/src/hb-utf-private.hh
@@ -134,7 +134,8 @@ hb_utf_prev (const uint16_t *text,
 	     const uint16_t *start,
 	     hb_codepoint_t *unicode)
 {
-  hb_codepoint_t c = *--text;
+  const uint16_t *end = text--;
+  hb_codepoint_t c = *text;
 
   if (likely (!hb_in_range (c, 0xD800u, 0xDFFFu)))
   {
@@ -142,22 +143,14 @@ hb_utf_prev (const uint16_t *text,
     return text;
   }
 
-  if (likely (hb_in_range (c, 0xDC00u, 0xDFFFu)))
-  {
-    /* Low-surrogate in c */
-    hb_codepoint_t h;
-    if (start < text && ((h = *(text - 1)), likely (hb_in_range (h, 0xD800u, 0xDBFFu))))
-    {
-      /* High-surrogate in h */
-      *unicode = (h << 10) + c - ((0xD800u << 10) - 0x10000u + 0xDC00u);
-       text--;
-       return text;
-    }
-  }
+  if (likely (start < text && hb_in_range (c, 0xDC00u, 0xDFFFu)))
+    text--;
+
+  if (likely (hb_utf_next (text, end, unicode) == end))
+    return text;
 
-  /* Lonely / out-of-order surrogate. */
   *unicode = -1;
-  return text;
+  return end - 1;
 }
 
 
commit c09a607a842fdd7b33e2c57e8af96d21ff091acd
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Jul 11 15:05:36 2014 -0400

    Use hb_in_range() for arabic and indic tables
    
    Though, looks like gcc was smart enough to produce the same code
    before...

diff --git a/src/gen-arabic-table.py b/src/gen-arabic-table.py
index c484708..308435f 100755
--- a/src/gen-arabic-table.py
+++ b/src/gen-arabic-table.py
@@ -90,7 +90,7 @@ def print_joining_table(f):
 	for start,end in ranges:
 
 		print
-		print "#define joining_offset_0x%04x %d" % (start, offset)
+		print "#define joining_offset_0x%04xu %d" % (start, offset)
 
 		for u in range(start, end+1):
 
@@ -130,11 +130,11 @@ def print_joining_table(f):
 	print "  {"
 	pages = set([u>>page_bits for u in [s for s,e in ranges]+[e for s,e in ranges]])
 	for p in sorted(pages):
-		print "    case 0x%0X:" % p
+		print "    case 0x%0Xu:" % p
 		for (start,end) in ranges:
 			if p not in [start>>page_bits, end>>page_bits]: continue
-			offset = "joining_offset_0x%04x" % start
-			print "      if (0x%04X <= u && u <= 0x%04X) return joining_table[u - 0x%04X + %s];" % (start, end, start, offset)
+			offset = "joining_offset_0x%04xu" % start
+			print "      if (hb_in_range (u, 0x%04Xu, 0x%04Xu)) return joining_table[u - 0x%04Xu + %s];" % (start, end, start, offset)
 		print "      break;"
 		print ""
 	print "    default:"
@@ -195,13 +195,13 @@ def print_shaping_table(f):
 	for u in range (min_u, max_u + 1):
 		s = [shapes[u][shape] if u in shapes and shape in shapes[u] else 0
 		     for shape in  ['initial', 'medial', 'final', 'isolated']]
-		value = ', '.join ("0x%04X" % c for c in s)
+		value = ', '.join ("0x%04Xu" % c for c in s)
 		print "  {%s}, /* U+%04X %s */" % (value, u, names[u] if u in names else "")
 
 	print "};"
 	print
-	print "#define SHAPING_TABLE_FIRST	0x%04X" % min_u
-	print "#define SHAPING_TABLE_LAST	0x%04X" % max_u
+	print "#define SHAPING_TABLE_FIRST	0x%04Xu" % min_u
+	print "#define SHAPING_TABLE_LAST	0x%04Xu" % max_u
 	print
 
 	ligas = {}
@@ -231,9 +231,9 @@ def print_shaping_table(f):
 	keys.sort ()
 	for first in keys:
 
-		print "  { 0x%04X, {" % (first)
+		print "  { 0x%04Xu, {" % (first)
 		for liga in ligas[first]:
-			print "    { 0x%04X, 0x%04X }, /* %s */" % (liga[0], liga[1], names[liga[1]])
+			print "    { 0x%04Xu, 0x%04Xu }, /* %s */" % (liga[0], liga[1], names[liga[1]])
 		print "  }},"
 
 	print "};"
diff --git a/src/gen-indic-table.py b/src/gen-indic-table.py
index c63fe23..4fb76f4 100755
--- a/src/gen-indic-table.py
+++ b/src/gen-indic-table.py
@@ -185,7 +185,7 @@ for u in uu:
 				offset += ends[-1] - starts[-1]
 			print
 			print
-			print "#define indic_offset_0x%04x %d" % (start, offset)
+			print "#define indic_offset_0x%04xu %d" % (start, offset)
 			starts.append (start)
 
 	print_block (block, start, end, data)
@@ -205,14 +205,14 @@ print "  switch (u >> %d)" % page_bits
 print "  {"
 pages = set([u>>page_bits for u in starts+ends+singles.keys()])
 for p in sorted(pages):
-	print "    case 0x%0X:" % p
+	print "    case 0x%0Xu:" % p
 	for (start,end) in zip (starts, ends):
 		if p not in [start>>page_bits, end>>page_bits]: continue
-		offset = "indic_offset_0x%04x" % start
-		print "      if (0x%04X <= u && u <= 0x%04X) return indic_table[u - 0x%04X + %s];" % (start, end, start, offset)
+		offset = "indic_offset_0x%04xu" % start
+		print "      if (hb_in_range (u, 0x%04Xu, 0x%04Xu)) return indic_table[u - 0x%04Xu + %s];" % (start, end, start, offset)
 	for u,d in singles.items ():
 		if p != u>>page_bits: continue
-		print "      if (unlikely (u == 0x%04X)) return _(%s,%s);" % (u, short[0][d[0]], short[1][d[1]])
+		print "      if (unlikely (u == 0x%04Xu)) return _(%s,%s);" % (u, short[0][d[0]], short[1][d[1]])
 	print "      break;"
 	print ""
 print "    default:"
diff --git a/src/hb-ot-shape-complex-arabic-table.hh b/src/hb-ot-shape-complex-arabic-table.hh
index ae7011a..d41d6ce 100644
--- a/src/hb-ot-shape-complex-arabic-table.hh
+++ b/src/hb-ot-shape-complex-arabic-table.hh
@@ -29,7 +29,7 @@
 static const uint8_t joining_table[] =
 {
 
-#define joining_offset_0x0600 0
+#define joining_offset_0x0600u 0
 
   /* Arabic */
 
@@ -78,7 +78,7 @@ static const uint8_t joining_table[] =
 
   /* 08A0 */ D,D,D,D,D,D,D,D,D,D,R,R,R,U,R,D,D,R,R,
 
-#define joining_offset_0x1806 691
+#define joining_offset_0x1806u 691
 
   /* Mongolian */
 
@@ -89,33 +89,33 @@ static const uint8_t joining_table[] =
   /* 1880 */ U,U,U,U,U,U,U,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
   /* 18A0 */ D,D,D,D,D,D,D,D,D,X,D,
 
-#define joining_offset_0x200c 856
+#define joining_offset_0x200cu 856
 
   /* General Punctuation */
 
   /* 2000 */                         U,C,
 
-#define joining_offset_0x2066 858
+#define joining_offset_0x2066u 858
 
   /* General Punctuation */
 
   /* 2060 */             U,U,U,U,
 
-#define joining_offset_0xa840 862
+#define joining_offset_0xa840u 862
 
   /* Phags-pa */
 
   /* A840 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
   /* A860 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,L,U,
 
-#define joining_offset_0x10ac0 914
+#define joining_offset_0x10ac0u 914
 
   /* Manichaean */
 
   /* 10AC0 */ D,D,D,D,D,R,U,R,U,R,R,U,U,L,R,R,R,R,R,D,D,D,D,L,D,D,D,D,D,R,D,D,
   /* 10AE0 */ D,R,U,U,R,X,X,X,X,X,X,D,D,D,D,R,
 
-#define joining_offset_0x10b80 962
+#define joining_offset_0x10b80u 962
 
   /* Psalter Pahlavi */
 
@@ -130,26 +130,26 @@ joining_type (hb_codepoint_t u)
 {
   switch (u >> 12)
   {
-    case 0x0:
-      if (0x0600 <= u && u <= 0x08B2) return joining_table[u - 0x0600 + joining_offset_0x0600];
+    case 0x0u:
+      if (hb_in_range (u, 0x0600u, 0x08B2u)) return joining_table[u - 0x0600u + joining_offset_0x0600u];
       break;
 
-    case 0x1:
-      if (0x1806 <= u && u <= 0x18AA) return joining_table[u - 0x1806 + joining_offset_0x1806];
+    case 0x1u:
+      if (hb_in_range (u, 0x1806u, 0x18AAu)) return joining_table[u - 0x1806u + joining_offset_0x1806u];
       break;
 
-    case 0x2:
-      if (0x200C <= u && u <= 0x200D) return joining_table[u - 0x200C + joining_offset_0x200c];
-      if (0x2066 <= u && u <= 0x2069) return joining_table[u - 0x2066 + joining_offset_0x2066];
+    case 0x2u:
+      if (hb_in_range (u, 0x200Cu, 0x200Du)) return joining_table[u - 0x200Cu + joining_offset_0x200cu];
+      if (hb_in_range (u, 0x2066u, 0x2069u)) return joining_table[u - 0x2066u + joining_offset_0x2066u];
       break;
 
-    case 0xA:
-      if (0xA840 <= u && u <= 0xA873) return joining_table[u - 0xA840 + joining_offset_0xa840];
+    case 0xAu:
+      if (hb_in_range (u, 0xA840u, 0xA873u)) return joining_table[u - 0xA840u + joining_offset_0xa840u];
       break;
 
-    case 0x10:
-      if (0x10AC0 <= u && u <= 0x10AEF) return joining_table[u - 0x10AC0 + joining_offset_0x10ac0];
-      if (0x10B80 <= u && u <= 0x10BAF) return joining_table[u - 0x10B80 + joining_offset_0x10b80];
+    case 0x10u:
+      if (hb_in_range (u, 0x10AC0u, 0x10AEFu)) return joining_table[u - 0x10AC0u + joining_offset_0x10ac0u];
+      if (hb_in_range (u, 0x10B80u, 0x10BAFu)) return joining_table[u - 0x10B80u + joining_offset_0x10b80u];
       break;
 
     default:
@@ -170,189 +170,189 @@ joining_type (hb_codepoint_t u)
 
 static const uint16_t shaping_table[][4] =
 {
-  {0x0000, 0x0000, 0x0000, 0xFE80}, /* U+0621 ARABIC LETTER HAMZA ISOLATED FORM */
-  {0x0000, 0x0000, 0xFE82, 0xFE81}, /* U+0622 ARABIC LETTER ALEF WITH MADDA ABOVE */
-  {0x0000, 0x0000, 0xFE84, 0xFE83}, /* U+0623 ARABIC LETTER ALEF WITH HAMZA ABOVE */
-  {0x0000, 0x0000, 0xFE86, 0xFE85}, /* U+0624 ARABIC LETTER WAW WITH HAMZA ABOVE */
-  {0x0000, 0x0000, 0xFE88, 0xFE87}, /* U+0625 ARABIC LETTER ALEF WITH HAMZA BELOW */
-  {0xFE8B, 0xFE8C, 0xFE8A, 0xFE89}, /* U+0626 ARABIC LETTER YEH WITH HAMZA ABOVE */
-  {0x0000, 0x0000, 0xFE8E, 0xFE8D}, /* U+0627 ARABIC LETTER ALEF */
-  {0xFE91, 0xFE92, 0xFE90, 0xFE8F}, /* U+0628 ARABIC LETTER BEH */
-  {0x0000, 0x0000, 0xFE94, 0xFE93}, /* U+0629 ARABIC LETTER TEH MARBUTA */
-  {0xFE97, 0xFE98, 0xFE96, 0xFE95}, /* U+062A ARABIC LETTER TEH */
-  {0xFE9B, 0xFE9C, 0xFE9A, 0xFE99}, /* U+062B ARABIC LETTER THEH */
-  {0xFE9F, 0xFEA0, 0xFE9E, 0xFE9D}, /* U+062C ARABIC LETTER JEEM */
-  {0xFEA3, 0xFEA4, 0xFEA2, 0xFEA1}, /* U+062D ARABIC LETTER HAH */
-  {0xFEA7, 0xFEA8, 0xFEA6, 0xFEA5}, /* U+062E ARABIC LETTER KHAH */
-  {0x0000, 0x0000, 0xFEAA, 0xFEA9}, /* U+062F ARABIC LETTER DAL */
-  {0x0000, 0x0000, 0xFEAC, 0xFEAB}, /* U+0630 ARABIC LETTER THAL */
-  {0x0000, 0x0000, 0xFEAE, 0xFEAD}, /* U+0631 ARABIC LETTER REH */
-  {0x0000, 0x0000, 0xFEB0, 0xFEAF}, /* U+0632 ARABIC LETTER ZAIN */
-  {0xFEB3, 0xFEB4, 0xFEB2, 0xFEB1}, /* U+0633 ARABIC LETTER SEEN */
-  {0xFEB7, 0xFEB8, 0xFEB6, 0xFEB5}, /* U+0634 ARABIC LETTER SHEEN */
-  {0xFEBB, 0xFEBC, 0xFEBA, 0xFEB9}, /* U+0635 ARABIC LETTER SAD */
-  {0xFEBF, 0xFEC0, 0xFEBE, 0xFEBD}, /* U+0636 ARABIC LETTER DAD */
-  {0xFEC3, 0xFEC4, 0xFEC2, 0xFEC1}, /* U+0637 ARABIC LETTER TAH */
-  {0xFEC7, 0xFEC8, 0xFEC6, 0xFEC5}, /* U+0638 ARABIC LETTER ZAH */
-  {0xFECB, 0xFECC, 0xFECA, 0xFEC9}, /* U+0639 ARABIC LETTER AIN */
-  {0xFECF, 0xFED0, 0xFECE, 0xFECD}, /* U+063A ARABIC LETTER GHAIN */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+063B  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+063C  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+063D  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+063E  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+063F  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0640  */
-  {0xFED3, 0xFED4, 0xFED2, 0xFED1}, /* U+0641 ARABIC LETTER FEH */
-  {0xFED7, 0xFED8, 0xFED6, 0xFED5}, /* U+0642 ARABIC LETTER QAF */
-  {0xFEDB, 0xFEDC, 0xFEDA, 0xFED9}, /* U+0643 ARABIC LETTER KAF */
-  {0xFEDF, 0xFEE0, 0xFEDE, 0xFEDD}, /* U+0644 ARABIC LETTER LAM */
-  {0xFEE3, 0xFEE4, 0xFEE2, 0xFEE1}, /* U+0645 ARABIC LETTER MEEM */
-  {0xFEE7, 0xFEE8, 0xFEE6, 0xFEE5}, /* U+0646 ARABIC LETTER NOON */
-  {0xFEEB, 0xFEEC, 0xFEEA, 0xFEE9}, /* U+0647 ARABIC LETTER HEH */
-  {0x0000, 0x0000, 0xFEEE, 0xFEED}, /* U+0648 ARABIC LETTER WAW */
-  {0xFBE8, 0xFBE9, 0xFEF0, 0xFEEF}, /* U+0649 ARABIC LETTER */
-  {0xFEF3, 0xFEF4, 0xFEF2, 0xFEF1}, /* U+064A ARABIC LETTER YEH */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+064B  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+064C  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+064D  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+064E  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+064F  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0650  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0651  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0652  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0653  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0654  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0655  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0656  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0657  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0658  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0659  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+065A  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+065B  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+065C  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+065D  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+065E  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+065F  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0660  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0661  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0662  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0663  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0664  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0665  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0666  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0667  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0668  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0669  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+066A  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+066B  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+066C  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+066D  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+066E  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+066F  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0670  */
-  {0x0000, 0x0000, 0xFB51, 0xFB50}, /* U+0671 ARABIC LETTER ALEF WASLA */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0672  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0673  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0674  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0675  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0676  */
-  {0x0000, 0x0000, 0x0000, 0xFBDD}, /* U+0677 ARABIC LETTER U WITH HAMZA ABOVE ISOLATED FORM */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0678  */
-  {0xFB68, 0xFB69, 0xFB67, 0xFB66}, /* U+0679 ARABIC LETTER TTEH */
-  {0xFB60, 0xFB61, 0xFB5F, 0xFB5E}, /* U+067A ARABIC LETTER TTEHEH */
-  {0xFB54, 0xFB55, 0xFB53, 0xFB52}, /* U+067B ARABIC LETTER BEEH */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+067C  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+067D  */
-  {0xFB58, 0xFB59, 0xFB57, 0xFB56}, /* U+067E ARABIC LETTER PEH */
-  {0xFB64, 0xFB65, 0xFB63, 0xFB62}, /* U+067F ARABIC LETTER TEHEH */
-  {0xFB5C, 0xFB5D, 0xFB5B, 0xFB5A}, /* U+0680 ARABIC LETTER BEHEH */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0681  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0682  */
-  {0xFB78, 0xFB79, 0xFB77, 0xFB76}, /* U+0683 ARABIC LETTER NYEH */
-  {0xFB74, 0xFB75, 0xFB73, 0xFB72}, /* U+0684 ARABIC LETTER DYEH */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0685  */
-  {0xFB7C, 0xFB7D, 0xFB7B, 0xFB7A}, /* U+0686 ARABIC LETTER TCHEH */
-  {0xFB80, 0xFB81, 0xFB7F, 0xFB7E}, /* U+0687 ARABIC LETTER TCHEHEH */
-  {0x0000, 0x0000, 0xFB89, 0xFB88}, /* U+0688 ARABIC LETTER DDAL */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0689  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+068A  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+068B  */
-  {0x0000, 0x0000, 0xFB85, 0xFB84}, /* U+068C ARABIC LETTER DAHAL */
-  {0x0000, 0x0000, 0xFB83, 0xFB82}, /* U+068D ARABIC LETTER DDAHAL */
-  {0x0000, 0x0000, 0xFB87, 0xFB86}, /* U+068E ARABIC LETTER DUL */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+068F  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0690  */
-  {0x0000, 0x0000, 0xFB8D, 0xFB8C}, /* U+0691 ARABIC LETTER RREH */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0692  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0693  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0694  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0695  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0696  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0697  */
-  {0x0000, 0x0000, 0xFB8B, 0xFB8A}, /* U+0698 ARABIC LETTER JEH */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+0699  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+069A  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+069B  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+069C  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+069D  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+069E  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+069F  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+06A0  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+06A1  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+06A2  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+06A3  */
-  {0xFB6C, 0xFB6D, 0xFB6B, 0xFB6A}, /* U+06A4 ARABIC LETTER VEH */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+06A5  */
-  {0xFB70, 0xFB71, 0xFB6F, 0xFB6E}, /* U+06A6 ARABIC LETTER PEHEH */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+06A7  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+06A8  */
-  {0xFB90, 0xFB91, 0xFB8F, 0xFB8E}, /* U+06A9 ARABIC LETTER KEHEH */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+06AA  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+06AB  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+06AC  */
-  {0xFBD5, 0xFBD6, 0xFBD4, 0xFBD3}, /* U+06AD ARABIC LETTER NG */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+06AE  */
-  {0xFB94, 0xFB95, 0xFB93, 0xFB92}, /* U+06AF ARABIC LETTER GAF */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+06B0  */
-  {0xFB9C, 0xFB9D, 0xFB9B, 0xFB9A}, /* U+06B1 ARABIC LETTER NGOEH */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+06B2  */
-  {0xFB98, 0xFB99, 0xFB97, 0xFB96}, /* U+06B3 ARABIC LETTER GUEH */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+06B4  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+06B5  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+06B6  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+06B7  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+06B8  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+06B9  */
-  {0x0000, 0x0000, 0xFB9F, 0xFB9E}, /* U+06BA ARABIC LETTER NOON GHUNNA */
-  {0xFBA2, 0xFBA3, 0xFBA1, 0xFBA0}, /* U+06BB ARABIC LETTER RNOON */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+06BC  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+06BD  */
-  {0xFBAC, 0xFBAD, 0xFBAB, 0xFBAA}, /* U+06BE ARABIC LETTER HEH DOACHASHMEE */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+06BF  */
-  {0x0000, 0x0000, 0xFBA5, 0xFBA4}, /* U+06C0 ARABIC LETTER HEH WITH YEH ABOVE */
-  {0xFBA8, 0xFBA9, 0xFBA7, 0xFBA6}, /* U+06C1 ARABIC LETTER HEH GOAL */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+06C2  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+06C3  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+06C4  */
-  {0x0000, 0x0000, 0xFBE1, 0xFBE0}, /* U+06C5 ARABIC LETTER KIRGHIZ OE */
-  {0x0000, 0x0000, 0xFBDA, 0xFBD9}, /* U+06C6 ARABIC LETTER OE */
-  {0x0000, 0x0000, 0xFBD8, 0xFBD7}, /* U+06C7 ARABIC LETTER U */
-  {0x0000, 0x0000, 0xFBDC, 0xFBDB}, /* U+06C8 ARABIC LETTER YU */
-  {0x0000, 0x0000, 0xFBE3, 0xFBE2}, /* U+06C9 ARABIC LETTER KIRGHIZ YU */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+06CA  */
-  {0x0000, 0x0000, 0xFBDF, 0xFBDE}, /* U+06CB ARABIC LETTER VE */
-  {0xFBFE, 0xFBFF, 0xFBFD, 0xFBFC}, /* U+06CC ARABIC LETTER FARSI YEH */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+06CD  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+06CE  */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+06CF  */
-  {0xFBE6, 0xFBE7, 0xFBE5, 0xFBE4}, /* U+06D0 ARABIC LETTER E */
-  {0x0000, 0x0000, 0x0000, 0x0000}, /* U+06D1  */
-  {0x0000, 0x0000, 0xFBAF, 0xFBAE}, /* U+06D2 ARABIC LETTER YEH BARREE */
-  {0x0000, 0x0000, 0xFBB1, 0xFBB0}, /* U+06D3 ARABIC LETTER YEH BARREE WITH HAMZA ABOVE */
+  {0x0000u, 0x0000u, 0x0000u, 0xFE80u}, /* U+0621 ARABIC LETTER HAMZA ISOLATED FORM */
+  {0x0000u, 0x0000u, 0xFE82u, 0xFE81u}, /* U+0622 ARABIC LETTER ALEF WITH MADDA ABOVE */
+  {0x0000u, 0x0000u, 0xFE84u, 0xFE83u}, /* U+0623 ARABIC LETTER ALEF WITH HAMZA ABOVE */
+  {0x0000u, 0x0000u, 0xFE86u, 0xFE85u}, /* U+0624 ARABIC LETTER WAW WITH HAMZA ABOVE */
+  {0x0000u, 0x0000u, 0xFE88u, 0xFE87u}, /* U+0625 ARABIC LETTER ALEF WITH HAMZA BELOW */
+  {0xFE8Bu, 0xFE8Cu, 0xFE8Au, 0xFE89u}, /* U+0626 ARABIC LETTER YEH WITH HAMZA ABOVE */
+  {0x0000u, 0x0000u, 0xFE8Eu, 0xFE8Du}, /* U+0627 ARABIC LETTER ALEF */
+  {0xFE91u, 0xFE92u, 0xFE90u, 0xFE8Fu}, /* U+0628 ARABIC LETTER BEH */
+  {0x0000u, 0x0000u, 0xFE94u, 0xFE93u}, /* U+0629 ARABIC LETTER TEH MARBUTA */
+  {0xFE97u, 0xFE98u, 0xFE96u, 0xFE95u}, /* U+062A ARABIC LETTER TEH */
+  {0xFE9Bu, 0xFE9Cu, 0xFE9Au, 0xFE99u}, /* U+062B ARABIC LETTER THEH */
+  {0xFE9Fu, 0xFEA0u, 0xFE9Eu, 0xFE9Du}, /* U+062C ARABIC LETTER JEEM */
+  {0xFEA3u, 0xFEA4u, 0xFEA2u, 0xFEA1u}, /* U+062D ARABIC LETTER HAH */
+  {0xFEA7u, 0xFEA8u, 0xFEA6u, 0xFEA5u}, /* U+062E ARABIC LETTER KHAH */
+  {0x0000u, 0x0000u, 0xFEAAu, 0xFEA9u}, /* U+062F ARABIC LETTER DAL */
+  {0x0000u, 0x0000u, 0xFEACu, 0xFEABu}, /* U+0630 ARABIC LETTER THAL */
+  {0x0000u, 0x0000u, 0xFEAEu, 0xFEADu}, /* U+0631 ARABIC LETTER REH */
+  {0x0000u, 0x0000u, 0xFEB0u, 0xFEAFu}, /* U+0632 ARABIC LETTER ZAIN */
+  {0xFEB3u, 0xFEB4u, 0xFEB2u, 0xFEB1u}, /* U+0633 ARABIC LETTER SEEN */
+  {0xFEB7u, 0xFEB8u, 0xFEB6u, 0xFEB5u}, /* U+0634 ARABIC LETTER SHEEN */
+  {0xFEBBu, 0xFEBCu, 0xFEBAu, 0xFEB9u}, /* U+0635 ARABIC LETTER SAD */
+  {0xFEBFu, 0xFEC0u, 0xFEBEu, 0xFEBDu}, /* U+0636 ARABIC LETTER DAD */
+  {0xFEC3u, 0xFEC4u, 0xFEC2u, 0xFEC1u}, /* U+0637 ARABIC LETTER TAH */
+  {0xFEC7u, 0xFEC8u, 0xFEC6u, 0xFEC5u}, /* U+0638 ARABIC LETTER ZAH */
+  {0xFECBu, 0xFECCu, 0xFECAu, 0xFEC9u}, /* U+0639 ARABIC LETTER AIN */
+  {0xFECFu, 0xFED0u, 0xFECEu, 0xFECDu}, /* U+063A ARABIC LETTER GHAIN */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+063B  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+063C  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+063D  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+063E  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+063F  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0640  */
+  {0xFED3u, 0xFED4u, 0xFED2u, 0xFED1u}, /* U+0641 ARABIC LETTER FEH */
+  {0xFED7u, 0xFED8u, 0xFED6u, 0xFED5u}, /* U+0642 ARABIC LETTER QAF */
+  {0xFEDBu, 0xFEDCu, 0xFEDAu, 0xFED9u}, /* U+0643 ARABIC LETTER KAF */
+  {0xFEDFu, 0xFEE0u, 0xFEDEu, 0xFEDDu}, /* U+0644 ARABIC LETTER LAM */
+  {0xFEE3u, 0xFEE4u, 0xFEE2u, 0xFEE1u}, /* U+0645 ARABIC LETTER MEEM */
+  {0xFEE7u, 0xFEE8u, 0xFEE6u, 0xFEE5u}, /* U+0646 ARABIC LETTER NOON */
+  {0xFEEBu, 0xFEECu, 0xFEEAu, 0xFEE9u}, /* U+0647 ARABIC LETTER HEH */
+  {0x0000u, 0x0000u, 0xFEEEu, 0xFEEDu}, /* U+0648 ARABIC LETTER WAW */
+  {0xFBE8u, 0xFBE9u, 0xFEF0u, 0xFEEFu}, /* U+0649 ARABIC LETTER */
+  {0xFEF3u, 0xFEF4u, 0xFEF2u, 0xFEF1u}, /* U+064A ARABIC LETTER YEH */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+064B  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+064C  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+064D  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+064E  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+064F  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0650  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0651  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0652  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0653  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0654  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0655  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0656  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0657  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0658  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0659  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+065A  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+065B  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+065C  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+065D  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+065E  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+065F  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0660  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0661  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0662  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0663  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0664  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0665  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0666  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0667  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0668  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0669  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+066A  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+066B  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+066C  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+066D  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+066E  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+066F  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0670  */
+  {0x0000u, 0x0000u, 0xFB51u, 0xFB50u}, /* U+0671 ARABIC LETTER ALEF WASLA */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0672  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0673  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0674  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0675  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0676  */
+  {0x0000u, 0x0000u, 0x0000u, 0xFBDDu}, /* U+0677 ARABIC LETTER U WITH HAMZA ABOVE ISOLATED FORM */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0678  */
+  {0xFB68u, 0xFB69u, 0xFB67u, 0xFB66u}, /* U+0679 ARABIC LETTER TTEH */
+  {0xFB60u, 0xFB61u, 0xFB5Fu, 0xFB5Eu}, /* U+067A ARABIC LETTER TTEHEH */
+  {0xFB54u, 0xFB55u, 0xFB53u, 0xFB52u}, /* U+067B ARABIC LETTER BEEH */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+067C  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+067D  */
+  {0xFB58u, 0xFB59u, 0xFB57u, 0xFB56u}, /* U+067E ARABIC LETTER PEH */
+  {0xFB64u, 0xFB65u, 0xFB63u, 0xFB62u}, /* U+067F ARABIC LETTER TEHEH */
+  {0xFB5Cu, 0xFB5Du, 0xFB5Bu, 0xFB5Au}, /* U+0680 ARABIC LETTER BEHEH */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0681  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0682  */
+  {0xFB78u, 0xFB79u, 0xFB77u, 0xFB76u}, /* U+0683 ARABIC LETTER NYEH */
+  {0xFB74u, 0xFB75u, 0xFB73u, 0xFB72u}, /* U+0684 ARABIC LETTER DYEH */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0685  */
+  {0xFB7Cu, 0xFB7Du, 0xFB7Bu, 0xFB7Au}, /* U+0686 ARABIC LETTER TCHEH */
+  {0xFB80u, 0xFB81u, 0xFB7Fu, 0xFB7Eu}, /* U+0687 ARABIC LETTER TCHEHEH */
+  {0x0000u, 0x0000u, 0xFB89u, 0xFB88u}, /* U+0688 ARABIC LETTER DDAL */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0689  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+068A  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+068B  */
+  {0x0000u, 0x0000u, 0xFB85u, 0xFB84u}, /* U+068C ARABIC LETTER DAHAL */
+  {0x0000u, 0x0000u, 0xFB83u, 0xFB82u}, /* U+068D ARABIC LETTER DDAHAL */
+  {0x0000u, 0x0000u, 0xFB87u, 0xFB86u}, /* U+068E ARABIC LETTER DUL */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+068F  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0690  */
+  {0x0000u, 0x0000u, 0xFB8Du, 0xFB8Cu}, /* U+0691 ARABIC LETTER RREH */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0692  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0693  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0694  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0695  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0696  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0697  */
+  {0x0000u, 0x0000u, 0xFB8Bu, 0xFB8Au}, /* U+0698 ARABIC LETTER JEH */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+0699  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+069A  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+069B  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+069C  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+069D  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+069E  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+069F  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+06A0  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+06A1  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+06A2  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+06A3  */
+  {0xFB6Cu, 0xFB6Du, 0xFB6Bu, 0xFB6Au}, /* U+06A4 ARABIC LETTER VEH */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+06A5  */
+  {0xFB70u, 0xFB71u, 0xFB6Fu, 0xFB6Eu}, /* U+06A6 ARABIC LETTER PEHEH */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+06A7  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+06A8  */
+  {0xFB90u, 0xFB91u, 0xFB8Fu, 0xFB8Eu}, /* U+06A9 ARABIC LETTER KEHEH */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+06AA  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+06AB  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+06AC  */
+  {0xFBD5u, 0xFBD6u, 0xFBD4u, 0xFBD3u}, /* U+06AD ARABIC LETTER NG */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+06AE  */
+  {0xFB94u, 0xFB95u, 0xFB93u, 0xFB92u}, /* U+06AF ARABIC LETTER GAF */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+06B0  */
+  {0xFB9Cu, 0xFB9Du, 0xFB9Bu, 0xFB9Au}, /* U+06B1 ARABIC LETTER NGOEH */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+06B2  */
+  {0xFB98u, 0xFB99u, 0xFB97u, 0xFB96u}, /* U+06B3 ARABIC LETTER GUEH */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+06B4  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+06B5  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+06B6  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+06B7  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+06B8  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+06B9  */
+  {0x0000u, 0x0000u, 0xFB9Fu, 0xFB9Eu}, /* U+06BA ARABIC LETTER NOON GHUNNA */
+  {0xFBA2u, 0xFBA3u, 0xFBA1u, 0xFBA0u}, /* U+06BB ARABIC LETTER RNOON */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+06BC  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+06BD  */
+  {0xFBACu, 0xFBADu, 0xFBABu, 0xFBAAu}, /* U+06BE ARABIC LETTER HEH DOACHASHMEE */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+06BF  */
+  {0x0000u, 0x0000u, 0xFBA5u, 0xFBA4u}, /* U+06C0 ARABIC LETTER HEH WITH YEH ABOVE */
+  {0xFBA8u, 0xFBA9u, 0xFBA7u, 0xFBA6u}, /* U+06C1 ARABIC LETTER HEH GOAL */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+06C2  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+06C3  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+06C4  */
+  {0x0000u, 0x0000u, 0xFBE1u, 0xFBE0u}, /* U+06C5 ARABIC LETTER KIRGHIZ OE */
+  {0x0000u, 0x0000u, 0xFBDAu, 0xFBD9u}, /* U+06C6 ARABIC LETTER OE */
+  {0x0000u, 0x0000u, 0xFBD8u, 0xFBD7u}, /* U+06C7 ARABIC LETTER U */
+  {0x0000u, 0x0000u, 0xFBDCu, 0xFBDBu}, /* U+06C8 ARABIC LETTER YU */
+  {0x0000u, 0x0000u, 0xFBE3u, 0xFBE2u}, /* U+06C9 ARABIC LETTER KIRGHIZ YU */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+06CA  */
+  {0x0000u, 0x0000u, 0xFBDFu, 0xFBDEu}, /* U+06CB ARABIC LETTER VE */
+  {0xFBFEu, 0xFBFFu, 0xFBFDu, 0xFBFCu}, /* U+06CC ARABIC LETTER FARSI YEH */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+06CD  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+06CE  */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+06CF  */
+  {0xFBE6u, 0xFBE7u, 0xFBE5u, 0xFBE4u}, /* U+06D0 ARABIC LETTER E */
+  {0x0000u, 0x0000u, 0x0000u, 0x0000u}, /* U+06D1  */
+  {0x0000u, 0x0000u, 0xFBAFu, 0xFBAEu}, /* U+06D2 ARABIC LETTER YEH BARREE */
+  {0x0000u, 0x0000u, 0xFBB1u, 0xFBB0u}, /* U+06D3 ARABIC LETTER YEH BARREE WITH HAMZA ABOVE */
 };
 
-#define SHAPING_TABLE_FIRST	0x0621
-#define SHAPING_TABLE_LAST	0x06D3
+#define SHAPING_TABLE_FIRST	0x0621u
+#define SHAPING_TABLE_LAST	0x06D3u
 
 
 static const struct ligature_set_t {
@@ -363,17 +363,17 @@ static const struct ligature_set_t {
  } ligatures[4];
 } ligature_table[] =
 {
-  { 0xFEDF, {
-    { 0xFE88, 0xFEF9 }, /* ARABIC LIGATURE LAM WITH ALEF WITH HAMZA BELOW ISOLATED FORM */
-    { 0xFE82, 0xFEF5 }, /* ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE ISOLATED FORM */
-    { 0xFE8E, 0xFEFB }, /* ARABIC LIGATURE LAM WITH ALEF ISOLATED FORM */
-    { 0xFE84, 0xFEF7 }, /* ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE ISOLATED FORM */
+  { 0xFEDFu, {
+    { 0xFE88u, 0xFEF9u }, /* ARABIC LIGATURE LAM WITH ALEF WITH HAMZA BELOW ISOLATED FORM */
+    { 0xFE82u, 0xFEF5u }, /* ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE ISOLATED FORM */
+    { 0xFE8Eu, 0xFEFBu }, /* ARABIC LIGATURE LAM WITH ALEF ISOLATED FORM */
+    { 0xFE84u, 0xFEF7u }, /* ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE ISOLATED FORM */
   }},
-  { 0xFEE0, {
-    { 0xFE88, 0xFEFA }, /* ARABIC LIGATURE LAM WITH ALEF WITH HAMZA BELOW FINAL FORM */
-    { 0xFE82, 0xFEF6 }, /* ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE FINAL FORM */
-    { 0xFE8E, 0xFEFC }, /* ARABIC LIGATURE LAM WITH ALEF FINAL FORM */
-    { 0xFE84, 0xFEF8 }, /* ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE FINAL FORM */
+  { 0xFEE0u, {
+    { 0xFE88u, 0xFEFAu }, /* ARABIC LIGATURE LAM WITH ALEF WITH HAMZA BELOW FINAL FORM */
+    { 0xFE82u, 0xFEF6u }, /* ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE FINAL FORM */
+    { 0xFE8Eu, 0xFEFCu }, /* ARABIC LIGATURE LAM WITH ALEF FINAL FORM */
+    { 0xFE84u, 0xFEF8u }, /* ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE FINAL FORM */
   }},
 };
 
diff --git a/src/hb-ot-shape-complex-indic-table.cc b/src/hb-ot-shape-complex-indic-table.cc
index 69da650..f58380e 100644
--- a/src/hb-ot-shape-complex-indic-table.cc
+++ b/src/hb-ot-shape-complex-indic-table.cc
@@ -70,7 +70,7 @@
 static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
 
 
-#define indic_offset_0x0028 0
+#define indic_offset_0x0028u 0
 
 
   /* Basic Latin */
@@ -79,14 +79,14 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
   /* 0030 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
   /* 0038 */ _(Nd,x), _(Nd,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
 
-#define indic_offset_0x00d0 24
+#define indic_offset_0x00d0u 24
 
 
   /* Latin-1 Supplement */
 
   /* 00D0 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x), _(CP,x),
 
-#define indic_offset_0x0900 32
+#define indic_offset_0x0900u 32
 
 
   /* Devanagari */
@@ -278,7 +278,7 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
   /* 0DE8 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
   /* 0DF0 */  _(x,x),  _(x,x),  _(M,R),  _(M,R),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
 
-#define indic_offset_0x1000 1304
+#define indic_offset_0x1000u 1304
 
 
   /* Myanmar */
@@ -304,7 +304,7 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
   /* 1090 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
   /* 1098 */ _(Nd,x), _(Nd,x), _(TM,x), _(TM,x),  _(M,R),  _(M,T),  _(x,x),  _(x,x),
 
-#define indic_offset_0x1700 1464
+#define indic_offset_0x1700u 1464
 
 
   /* Tagalog */
@@ -352,7 +352,7 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
   /* 17E0 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
   /* 17E8 */ _(Nd,x), _(Nd,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
 
-#define indic_offset_0x1900 1704
+#define indic_offset_0x1900u 1704
 
 
   /* Limbu */
@@ -422,7 +422,7 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
   /* 1A90 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
   /* 1A98 */ _(Nd,x), _(Nd,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
 
-#define indic_offset_0x1b00 2120
+#define indic_offset_0x1b00u 2120
 
 
   /* Balinese */
@@ -479,7 +479,7 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
   /* 1C40 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
   /* 1C48 */ _(Nd,x), _(Nd,x),  _(x,x),  _(x,x),  _(x,x),  _(C,x),  _(C,x),  _(C,x),
 
-#define indic_offset_0x1cd0 2456
+#define indic_offset_0x1cd0u 2456
 
 
   /* Vedic Extensions */
@@ -490,7 +490,7 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
   /* 1CE8 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
   /* 1CF0 */  _(x,x),  _(x,x), _(Vs,x), _(Vs,x), _(TM,x),  _(x,x),  _(x,x),  _(x,x),
 
-#define indic_offset_0x2008 2496
+#define indic_offset_0x2008u 2496
 
 
   /* General Punctuation */
@@ -498,7 +498,7 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
   /* 2008 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),_(ZWNJ,x),_(ZWJ,x),  _(x,x),  _(x,x),
   /* 2010 */  _(x,x),  _(x,x), _(CP,x), _(CP,x), _(CP,x),  _(x,x),  _(x,x),  _(x,x),
 
-#define indic_offset_0xa800 2512
+#define indic_offset_0xa800u 2512
 
 
   /* Syloti Nagri */
@@ -632,7 +632,7 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
   /* AAE8 */  _(C,x),  _(C,x),  _(C,x),  _(M,L),  _(M,B),  _(M,T),  _(M,L),  _(M,R),
   /* AAF0 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x), _(Vs,x), _(IS,x),  _(x,x),
 
-#define indic_offset_0xabc0 3272
+#define indic_offset_0xabc0u 3272
 
 
   /* Meetei Mayek */
@@ -646,7 +646,7 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
   /* ABF0 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
   /* ABF8 */ _(Nd,x), _(Nd,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
 
-#define indic_offset_0x10a00 3336
+#define indic_offset_0x10a00u 3336
 
 
   /* Kharoshthi */
@@ -661,7 +661,7 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
   /* 10A38 */  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x), _(IS,x),
   /* 10A40 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
 
-#define indic_offset_0x11000 3408
+#define indic_offset_0x11000u 3408
 
 
   /* Brahmi */
@@ -694,7 +694,7 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
   /* 110B0 */  _(M,R),  _(M,L),  _(M,R),  _(M,B),  _(M,B),  _(M,T),  _(M,T),  _(M,R),
   /* 110B8 */  _(M,R),  _(V,B),  _(N,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
 
-#define indic_offset_0x11100 3600
+#define indic_offset_0x11100u 3600
 
 
   /* Chakma */
@@ -751,7 +751,7 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
   /* 11228 */  _(C,x),  _(C,x),  _(C,x),  _(C,x),  _(M,R),  _(M,R),  _(M,R),  _(M,B),
   /* 11230 */  _(M,T),  _(M,T), _(M,TR), _(M,TR), _(Bi,x),  _(V,R),  _(N,x), _(GM,T),
 
-#define indic_offset_0x112b0 3912
+#define indic_offset_0x112b0u 3912
 
 
   /* Khudawadi */
@@ -785,7 +785,7 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
   /* 11368 */ _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x),  _(x,x),  _(x,x),  _(x,x),
   /* 11370 */ _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x), _(Ca,x),  _(x,x),  _(x,x),  _(x,x),
 
-#define indic_offset_0x11480 4112
+#define indic_offset_0x11480u 4112
 
 
   /* Tirhuta */
@@ -803,7 +803,7 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
   /* 114D0 */ _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x), _(Nd,x),
   /* 114D8 */ _(Nd,x), _(Nd,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
 
-#define indic_offset_0x11580 4208
+#define indic_offset_0x11580u 4208
 
 
   /* Siddham */
@@ -818,7 +818,7 @@ static const INDIC_TABLE_ELEMENT_TYPE indic_table[] = {
   /* 115B8 */  _(M,L), _(M,TL), _(M,LR),_(M,TLR), _(Bi,x), _(Bi,x), _(Vs,x),  _(V,B),
   /* 115C0 */  _(N,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),  _(x,x),
 
-#define indic_offset_0x11600 4280
+#define indic_offset_0x11600u 4280
 
 
   /* Modi */
@@ -860,42 +860,42 @@ hb_indic_get_categories (hb_codepoint_t u)
 {
   switch (u >> 12)
   {
-    case 0x0:
-      if (0x0028 <= u && u <= 0x0040) return indic_table[u - 0x0028 + indic_offset_0x0028];
-      if (0x00D0 <= u && u <= 0x00D8) return indic_table[u - 0x00D0 + indic_offset_0x00d0];
-      if (0x0900 <= u && u <= 0x0DF8) return indic_table[u - 0x0900 + indic_offset_0x0900];
-      if (unlikely (u == 0x00A0)) return _(CP,x);
+    case 0x0u:
+      if (hb_in_range (u, 0x0028u, 0x0040u)) return indic_table[u - 0x0028u + indic_offset_0x0028u];
+      if (hb_in_range (u, 0x00D0u, 0x00D8u)) return indic_table[u - 0x00D0u + indic_offset_0x00d0u];
+      if (hb_in_range (u, 0x0900u, 0x0DF8u)) return indic_table[u - 0x0900u + indic_offset_0x0900u];
+      if (unlikely (u == 0x00A0u)) return _(CP,x);
       break;
 
-    case 0x1:
-      if (0x1000 <= u && u <= 0x10A0) return indic_table[u - 0x1000 + indic_offset_0x1000];
-      if (0x1700 <= u && u <= 0x17F0) return indic_table[u - 0x1700 + indic_offset_0x1700];
-      if (0x1900 <= u && u <= 0x1AA0) return indic_table[u - 0x1900 + indic_offset_0x1900];
-      if (0x1B00 <= u && u <= 0x1C50) return indic_table[u - 0x1B00 + indic_offset_0x1b00];
-      if (0x1CD0 <= u && u <= 0x1CF8) return indic_table[u - 0x1CD0 + indic_offset_0x1cd0];
+    case 0x1u:
+      if (hb_in_range (u, 0x1000u, 0x10A0u)) return indic_table[u - 0x1000u + indic_offset_0x1000u];
+      if (hb_in_range (u, 0x1700u, 0x17F0u)) return indic_table[u - 0x1700u + indic_offset_0x1700u];
+      if (hb_in_range (u, 0x1900u, 0x1AA0u)) return indic_table[u - 0x1900u + indic_offset_0x1900u];
+      if (hb_in_range (u, 0x1B00u, 0x1C50u)) return indic_table[u - 0x1B00u + indic_offset_0x1b00u];
+      if (hb_in_range (u, 0x1CD0u, 0x1CF8u)) return indic_table[u - 0x1CD0u + indic_offset_0x1cd0u];
       break;
 
-    case 0x2:
-      if (0x2008 <= u && u <= 0x2018) return indic_table[u - 0x2008 + indic_offset_0x2008];
-      if (unlikely (u == 0x25CC)) return _(CP,x);
+    case 0x2u:
+      if (hb_in_range (u, 0x2008u, 0x2018u)) return indic_table[u - 0x2008u + indic_offset_0x2008u];
+      if (unlikely (u == 0x25CCu)) return _(CP,x);
       break;
 
-    case 0xA:
-      if (0xA800 <= u && u <= 0xAAF8) return indic_table[u - 0xA800 + indic_offset_0xa800];
-      if (0xABC0 <= u && u <= 0xAC00) return indic_table[u - 0xABC0 + indic_offset_0xabc0];
+    case 0xAu:
+      if (hb_in_range (u, 0xA800u, 0xAAF8u)) return indic_table[u - 0xA800u + indic_offset_0xa800u];
+      if (hb_in_range (u, 0xABC0u, 0xAC00u)) return indic_table[u - 0xABC0u + indic_offset_0xabc0u];
       break;
 
-    case 0x10:
-      if (0x10A00 <= u && u <= 0x10A48) return indic_table[u - 0x10A00 + indic_offset_0x10a00];
+    case 0x10u:
+      if (hb_in_range (u, 0x10A00u, 0x10A48u)) return indic_table[u - 0x10A00u + indic_offset_0x10a00u];
       break;
 
-    case 0x11:
-      if (0x11000 <= u && u <= 0x110C0) return indic_table[u - 0x11000 + indic_offset_0x11000];
-      if (0x11100 <= u && u <= 0x11238) return indic_table[u - 0x11100 + indic_offset_0x11100];
-      if (0x112B0 <= u && u <= 0x11378) return indic_table[u - 0x112B0 + indic_offset_0x112b0];
-      if (0x11480 <= u && u <= 0x114E0) return indic_table[u - 0x11480 + indic_offset_0x11480];
-      if (0x11580 <= u && u <= 0x115C8) return indic_table[u - 0x11580 + indic_offset_0x11580];
-      if (0x11600 <= u && u <= 0x116D0) return indic_table[u - 0x11600 + indic_offset_0x11600];
+    case 0x11u:
+      if (hb_in_range (u, 0x11000u, 0x110C0u)) return indic_table[u - 0x11000u + indic_offset_0x11000u];
+      if (hb_in_range (u, 0x11100u, 0x11238u)) return indic_table[u - 0x11100u + indic_offset_0x11100u];
+      if (hb_in_range (u, 0x112B0u, 0x11378u)) return indic_table[u - 0x112B0u + indic_offset_0x112b0u];
+      if (hb_in_range (u, 0x11480u, 0x114E0u)) return indic_table[u - 0x11480u + indic_offset_0x11480u];
+      if (hb_in_range (u, 0x11580u, 0x115C8u)) return indic_table[u - 0x11580u + indic_offset_0x11580u];
+      if (hb_in_range (u, 0x11600u, 0x116D0u)) return indic_table[u - 0x11600u + indic_offset_0x11600u];
       break;
 
     default:
commit 7627100f428ac0ec8509d961d368d2d25d8f0b6e
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Jul 11 14:54:42 2014 -0400

    Mark unsigned integer literals with the u suffix
    
    Simplifies hb_in_range() calls as the type can be inferred.
    The rest is obsessiveness, I admit.

diff --git a/src/hb-buffer-serialize.cc b/src/hb-buffer-serialize.cc
index 263bc81..406d69d 100644
--- a/src/hb-buffer-serialize.cc
+++ b/src/hb-buffer-serialize.cc
@@ -63,7 +63,7 @@ hb_buffer_serialize_format_t
 hb_buffer_serialize_format_from_string (const char *str, int len)
 {
   /* Upper-case it. */
-  return (hb_buffer_serialize_format_t) (hb_tag_from_string (str, len) & ~0x20202020);
+  return (hb_buffer_serialize_format_t) (hb_tag_from_string (str, len) & ~0x20202020u);
 }
 
 /**
diff --git a/src/hb-common.cc b/src/hb-common.cc
index da5f4f7..a089e52 100644
--- a/src/hb-common.cc
+++ b/src/hb-common.cc
@@ -371,7 +371,7 @@ hb_script_from_iso15924_tag (hb_tag_t tag)
     return HB_SCRIPT_INVALID;
 
   /* Be lenient, adjust case (one capital letter followed by three small letters) */
-  tag = (tag & 0xDFDFDFDF) | 0x00202020;
+  tag = (tag & 0xDFDFDFDFu) | 0x00202020u;
 
   switch (tag) {
 
@@ -391,7 +391,7 @@ hb_script_from_iso15924_tag (hb_tag_t tag)
   }
 
   /* If it looks right, just use the tag as a script */
-  if (((uint32_t) tag & 0xE0E0E0E0) == 0x40606060)
+  if (((uint32_t) tag & 0xE0E0E0E0u) == 0x40606060u)
     return (hb_script_t) tag;
 
   /* Otherwise, return unknown */
diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index 864e9e7..d92c6ba 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -610,13 +610,13 @@ _hb_coretext_shape (hb_shape_plan_t    *shape_plan,
   for (unsigned int i = 0; i < buffer->len; i++) {
     hb_codepoint_t c = buffer->info[i].codepoint;
     buffer->info[i].utf16_index() = chars_len;
-    if (likely (c < 0x10000))
+    if (likely (c <= 0xFFFFu))
       pchars[chars_len++] = c;
-    else if (unlikely (c >= 0x110000))
-      pchars[chars_len++] = 0xFFFD;
+    else if (unlikely (c > 0x10FFFFu))
+      pchars[chars_len++] = 0xFFFDu;
     else {
-      pchars[chars_len++] = 0xD800 + ((c - 0x10000) >> 10);
-      pchars[chars_len++] = 0xDC00 + ((c - 0x10000) & ((1 << 10) - 1));
+      pchars[chars_len++] = 0xD800u + ((c - 0x10000u) >> 10);
+      pchars[chars_len++] = 0xDC00u + ((c - 0x10000u) & ((1 << 10) - 1));
     }
   }
 
@@ -642,7 +642,7 @@ _hb_coretext_shape (hb_shape_plan_t    *shape_plan,
       hb_codepoint_t c = buffer->info[i].codepoint;
       unsigned int cluster = buffer->info[i].cluster;
       log_clusters[chars_len++] = cluster;
-      if (c >= 0x10000 && c < 0x110000)
+      if (hb_in_range (c, 0x10000u, 0x10FFFFu))
 	log_clusters[chars_len++] = cluster; /* Surrogates. */
     }
 
@@ -714,10 +714,10 @@ _hb_coretext_shape (hb_shape_plan_t    *shape_plan,
         for (CFIndex j = range.location; j < range.location + range.length; j++)
 	{
 	    UniChar ch = CFStringGetCharacterAtIndex (string_ref, j);
-	    if (hb_in_range<UniChar> (ch, 0xDC00, 0xDFFF) && range.location < j)
+	    if (hb_in_range<UniChar> (ch, 0xDC00u, 0xDFFFu) && range.location < j)
 	    {
 	      ch = CFStringGetCharacterAtIndex (string_ref, j - 1);
-	      if (hb_in_range<UniChar> (ch, 0xD800, 0xDBFF))
+	      if (hb_in_range<UniChar> (ch, 0xD800u, 0xDBFFu))
 	        /* This is the second of a surrogate pair.  Don't need .notdef
 		 * for this one. */
 	        continue;
diff --git a/src/hb-open-file-private.hh b/src/hb-open-file-private.hh
index de76a96..57db59d 100644
--- a/src/hb-open-file-private.hh
+++ b/src/hb-open-file-private.hh
@@ -138,7 +138,7 @@ struct TTCHeaderVersion1
   protected:
   Tag		ttcTag;		/* TrueType Collection ID string: 'ttcf' */
   FixedVersion	version;	/* Version of the TTC Header (1.0),
-				 * 0x00010000 */
+				 * 0x00010000u */
   ArrayOf<OffsetTo<OffsetTable, ULONG>, ULONG>
 		table;		/* Array of offsets to the OffsetTable for each font
 				 * from the beginning of the file */
@@ -184,7 +184,7 @@ struct TTCHeader
   struct {
   Tag		ttcTag;		/* TrueType Collection ID string: 'ttcf' */
   FixedVersion	version;	/* Version of the TTC Header (1.0 or 2.0),
-				 * 0x00010000 or 0x00020000 */
+				 * 0x00010000u or 0x00020000u */
   }			header;
   TTCHeaderVersion1	version1;
   } u;
diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh
index 5f4cd42..046df97 100644
--- a/src/hb-open-type-private.hh
+++ b/src/hb-open-type-private.hh
@@ -626,7 +626,7 @@ typedef USHORT GlyphID;
 
 /* Script/language-system/feature index */
 struct Index : USHORT {
-  static const unsigned int NOT_FOUND_INDEX = 0xFFFF;
+  static const unsigned int NOT_FOUND_INDEX = 0xFFFFu;
 };
 DEFINE_NULL_DATA (Index, "\xff\xff");
 
diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh
index e683b07..d531411 100644
--- a/src/hb-ot-cmap-table.hh
+++ b/src/hb-ot-cmap-table.hh
@@ -121,7 +121,7 @@ struct CmapSubtableFormat4
       gid += idDelta[i];
     }
 
-    *glyph = gid & 0xFFFF;
+    *glyph = gid & 0xFFFFu;
     return true;
   }
 
@@ -159,7 +159,7 @@ struct CmapSubtableFormat4
   USHORT	values[VAR];
 #if 0
   USHORT	endCount[segCount];	/* End characterCode for each segment,
-					 * last=0xFFFF. */
+					 * last=0xFFFFu. */
   USHORT	reservedPad;		/* Set to 0. */
   USHORT	startCount[segCount];	/* Start character code for each segment. */
   SHORT		idDelta[segCount];	/* Delta for all character codes in segment. */
diff --git a/src/hb-ot-head-table.hh b/src/hb-ot-head-table.hh
index 0285f0c..ec4e8c9 100644
--- a/src/hb-ot-head-table.hh
+++ b/src/hb-ot-head-table.hh
@@ -58,12 +58,12 @@ struct head
 
   protected:
   FixedVersion	version;		/* Version of the head table--currently
-					 * 0x00010000 for version 1.0. */
+					 * 0x00010000u for version 1.0. */
   FixedVersion	fontRevision;		/* Set by font manufacturer. */
   ULONG		checkSumAdjustment;	/* To compute: set it to 0, sum the
 					 * entire font as ULONG, then store
-					 * 0xB1B0AFBA - sum. */
-  ULONG		magicNumber;		/* Set to 0x5F0F3CF5. */
+					 * 0xB1B0AFBAu - sum. */
+  ULONG		magicNumber;		/* Set to 0x5F0F3CF5u. */
   USHORT	flags;			/* Bit 0: Baseline for font at y=0;
 					 * Bit 1: Left sidebearing point at x=0;
 					 * Bit 2: Instructions may depend on point size;
diff --git a/src/hb-ot-hhea-table.hh b/src/hb-ot-hhea-table.hh
index f34bd26..d433200 100644
--- a/src/hb-ot-hhea-table.hh
+++ b/src/hb-ot-hhea-table.hh
@@ -50,7 +50,7 @@ struct hhea
   }
 
   public:
-  FixedVersion	version;		/* 0x00010000 for version 1.0. */
+  FixedVersion	version;		/* 0x00010000u for version 1.0. */
   FWORD		ascender;		/* Typographic ascent. <a
 					 * href="http://developer.apple.com/fonts/TTRefMan/RM06/Chap6hhea.html">
 					 * (Distance from baseline of highest
diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh
index c9b4b2f..abd063c 100644
--- a/src/hb-ot-layout-common-private.hh
+++ b/src/hb-ot-layout-common-private.hh
@@ -190,10 +190,10 @@ struct LangSys
 					   unsigned int *feature_indexes /* OUT */) const
   { return featureIndex.get_indexes (start_offset, feature_count, feature_indexes); }
 
-  inline bool has_required_feature (void) const { return reqFeatureIndex != 0xffff; }
+  inline bool has_required_feature (void) const { return reqFeatureIndex != 0xFFFFu; }
   inline unsigned int get_required_feature_index (void) const
   {
-    if (reqFeatureIndex == 0xffff)
+    if (reqFeatureIndex == 0xFFFFu)
       return Index::NOT_FOUND_INDEX;
    return reqFeatureIndex;;
   }
@@ -208,7 +208,7 @@ struct LangSys
 				 * reordering table) */
   USHORT	reqFeatureIndex;/* Index of a feature required for this
 				 * language system--if no required features
-				 * = 0xFFFF */
+				 * = 0xFFFFu */
   IndexArray	featureIndex;	/* Array of indices into the FeatureList */
   public:
   DEFINE_SIZE_ARRAY (6, featureIndex);
@@ -448,9 +448,9 @@ struct FeatureParams
     TRACE_SANITIZE (this);
     if (tag == HB_TAG ('s','i','z','e'))
       return TRACE_RETURN (u.size.sanitize (c));
-    if ((tag & 0xFFFF0000) == HB_TAG ('s','s','\0','\0')) /* ssXX */
+    if ((tag & 0xFFFF0000u) == HB_TAG ('s','s','\0','\0')) /* ssXX */
       return TRACE_RETURN (u.stylisticSet.sanitize (c));
-    if ((tag & 0xFFFF0000) == HB_TAG ('c','v','\0','\0')) /* cvXX */
+    if ((tag & 0xFFFF0000u) == HB_TAG ('c','v','\0','\0')) /* cvXX */
       return TRACE_RETURN (u.characterVariants.sanitize (c));
     return TRACE_RETURN (true);
   }
@@ -585,7 +585,7 @@ struct Lookup
     TRACE_SERIALIZE (this);
     if (unlikely (!c->extend_min (*this))) return TRACE_RETURN (false);
     lookupType.set (lookup_type);
-    lookupFlag.set (lookup_props & 0xFFFF);
+    lookupFlag.set (lookup_props & 0xFFFFu);
     if (unlikely (!subTable.serialize (c, num_subtables))) return TRACE_RETURN (false);
     if (lookupFlag & LookupFlag::UseMarkFilteringSet)
     {
@@ -1131,7 +1131,7 @@ struct Device
 
     unsigned int byte = deltaValue[s >> (4 - f)];
     unsigned int bits = (byte >> (16 - (((s & ((1 << (4 - f)) - 1)) + 1) << f)));
-    unsigned int mask = (0xFFFF >> (16 - (1 << f)));
+    unsigned int mask = (0xFFFFu >> (16 - (1 << f)));
 
     int delta = bits & mask;
 
diff --git a/src/hb-ot-layout-gdef-table.hh b/src/hb-ot-layout-gdef-table.hh
index bb8a4b9..84a5e79 100644
--- a/src/hb-ot-layout-gdef-table.hh
+++ b/src/hb-ot-layout-gdef-table.hh
@@ -360,9 +360,9 @@ struct GDEF
 				      hb_position_t *caret_array /* OUT */) const
   { return (this+ligCaretList).get_lig_carets (font, direction, glyph_id, start_offset, caret_count, caret_array); }
 
-  inline bool has_mark_sets (void) const { return version.to_int () >= 0x00010002 && markGlyphSetsDef[0] != 0; }
+  inline bool has_mark_sets (void) const { return version.to_int () >= 0x00010002u && markGlyphSetsDef[0] != 0; }
   inline bool mark_set_covers (unsigned int set_index, hb_codepoint_t glyph_id) const
-  { return version.to_int () >= 0x00010002 && (this+markGlyphSetsDef[0]).covers (set_index, glyph_id); }
+  { return version.to_int () >= 0x00010002u && (this+markGlyphSetsDef[0]).covers (set_index, glyph_id); }
 
   inline bool sanitize (hb_sanitize_context_t *c) {
     TRACE_SANITIZE (this);
@@ -372,7 +372,7 @@ struct GDEF
 			 attachList.sanitize (c, this) &&
 			 ligCaretList.sanitize (c, this) &&
 			 markAttachClassDef.sanitize (c, this) &&
-			 (version.to_int () < 0x00010002 || markGlyphSetsDef[0].sanitize (c, this)));
+			 (version.to_int () < 0x00010002u || markGlyphSetsDef[0].sanitize (c, this)));
   }
 
 
@@ -400,7 +400,7 @@ struct GDEF
 
   protected:
   FixedVersion	version;		/* Version of the GDEF table--currently
-					 * 0x00010002 */
+					 * 0x00010002u */
   OffsetTo<ClassDef>
 		glyphClassDef;		/* Offset to class definition table
 					 * for glyph type--from beginning of
diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh
index 91e1f8b..d8e3e6e 100644
--- a/src/hb-ot-layout-gpos-table.hh
+++ b/src/hb-ot-layout-gpos-table.hh
@@ -49,18 +49,18 @@ typedef Value ValueRecord[VAR];
 struct ValueFormat : USHORT
 {
   enum Flags {
-    xPlacement	= 0x0001,	/* Includes horizontal adjustment for placement */
-    yPlacement	= 0x0002,	/* Includes vertical adjustment for placement */
-    xAdvance	= 0x0004,	/* Includes horizontal adjustment for advance */
-    yAdvance	= 0x0008,	/* Includes vertical adjustment for advance */
-    xPlaDevice	= 0x0010,	/* Includes horizontal Device table for placement */
-    yPlaDevice	= 0x0020,	/* Includes vertical Device table for placement */
-    xAdvDevice	= 0x0040,	/* Includes horizontal Device table for advance */
-    yAdvDevice	= 0x0080,	/* Includes vertical Device table for advance */
-    ignored	= 0x0F00,	/* Was used in TrueType Open for MM fonts */
-    reserved	= 0xF000,	/* For future use */
-
-    devices	= 0x00F0	/* Mask for having any Device table */
+    xPlacement	= 0x0001u,	/* Includes horizontal adjustment for placement */
+    yPlacement	= 0x0002u,	/* Includes vertical adjustment for placement */
+    xAdvance	= 0x0004u,	/* Includes horizontal adjustment for advance */
+    yAdvance	= 0x0008u,	/* Includes vertical adjustment for advance */
+    xPlaDevice	= 0x0010u,	/* Includes horizontal Device table for placement */
+    yPlaDevice	= 0x0020u,	/* Includes vertical Device table for placement */
+    xAdvDevice	= 0x0040u,	/* Includes horizontal Device table for advance */
+    yAdvDevice	= 0x0080u,	/* Includes vertical Device table for advance */
+    ignored	= 0x0F00u,	/* Was used in TrueType Open for MM fonts */
+    reserved	= 0xF000u,	/* For future use */
+
+    devices	= 0x00F0u	/* Mask for having any Device table */
   };
 
 /* All fields are options.  Only those available advance the value pointer. */
diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh
index 2e867e3..e193973 100644
--- a/src/hb-ot-layout-gsub-table.hh
+++ b/src/hb-ot-layout-gsub-table.hh
@@ -44,7 +44,7 @@ struct SingleSubstFormat1
     for (iter.init (this+coverage); iter.more (); iter.next ()) {
       hb_codepoint_t glyph_id = iter.get_glyph ();
       if (c->glyphs->has (glyph_id))
-	c->glyphs->add ((glyph_id + deltaGlyphID) & 0xFFFF);
+	c->glyphs->add ((glyph_id + deltaGlyphID) & 0xFFFFu);
     }
   }
 
@@ -55,7 +55,7 @@ struct SingleSubstFormat1
     for (iter.init (this+coverage); iter.more (); iter.next ()) {
       hb_codepoint_t glyph_id = iter.get_glyph ();
       c->input->add (glyph_id);
-      c->output->add ((glyph_id + deltaGlyphID) & 0xFFFF);
+      c->output->add ((glyph_id + deltaGlyphID) & 0xFFFFu);
     }
   }
 
@@ -79,7 +79,7 @@ struct SingleSubstFormat1
 
     /* According to the Adobe Annotated OpenType Suite, result is always
      * limited to 16bit. */
-    glyph_id = (glyph_id + deltaGlyphID) & 0xFFFF;
+    glyph_id = (glyph_id + deltaGlyphID) & 0xFFFFu;
     c->replace_glyph (glyph_id);
 
     return TRACE_RETURN (true);
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index 8f8d7b8..0416589 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -2294,7 +2294,7 @@ struct GSUBGPOS
 
   protected:
   FixedVersion	version;	/* Version of the GSUB/GPOS table--initially set
-				 * to 0x00010000 */
+				 * to 0x00010000u */
   OffsetTo<ScriptList>
 		scriptList;  	/* ScriptList table */
   OffsetTo<FeatureList>
diff --git a/src/hb-ot-layout-jstf-table.hh b/src/hb-ot-layout-jstf-table.hh
index 79eb859..67a6df5 100644
--- a/src/hb-ot-layout-jstf-table.hh
+++ b/src/hb-ot-layout-jstf-table.hh
@@ -214,7 +214,7 @@ struct JSTF
 
   protected:
   FixedVersion	version;	/* Version of the JSTF table--initially set
-				 * to 0x00010000 */
+				 * to 0x00010000u */
   RecordArrayOf<JstfScript>
 		scriptList;  	/* Array of JstfScripts--listed
 				 * alphabetically by ScriptTag */
diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout-private.hh
index e66e19c..9b06300 100644
--- a/src/hb-ot-layout-private.hh
+++ b/src/hb-ot-layout-private.hh
@@ -190,8 +190,8 @@ _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_unicode_funcs_t *uni
   /* XXX This shouldn't be inlined, or at least not while is_default_ignorable() is inline. */
   info->unicode_props0() = ((unsigned int) unicode->general_category (info->codepoint)) |
 			   (unicode->is_default_ignorable (info->codepoint) ? MASK0_IGNORABLE : 0) |
-			   (info->codepoint == 0x200C ? MASK0_ZWNJ : 0) |
-			   (info->codepoint == 0x200D ? MASK0_ZWJ : 0);
+			   (info->codepoint == 0x200Cu ? MASK0_ZWNJ : 0) |
+			   (info->codepoint == 0x200Du ? MASK0_ZWJ : 0);
   info->unicode_props1() = unicode->modified_combining_class (info->codepoint);
 }
 
diff --git a/src/hb-ot-layout.h b/src/hb-ot-layout.h
index 87171d7..949678a 100644
--- a/src/hb-ot-layout.h
+++ b/src/hb-ot-layout.h
@@ -92,9 +92,9 @@ hb_ot_layout_get_ligature_carets (hb_font_t      *font,
  * GSUB/GPOS feature query and enumeration interface
  */
 
-#define HB_OT_LAYOUT_NO_SCRIPT_INDEX		((unsigned int) 0xFFFF)
-#define HB_OT_LAYOUT_NO_FEATURE_INDEX		((unsigned int) 0xFFFF)
-#define HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX	((unsigned int) 0xFFFF)
+#define HB_OT_LAYOUT_NO_SCRIPT_INDEX		0xFFFFu
+#define HB_OT_LAYOUT_NO_FEATURE_INDEX		0xFFFFu
+#define HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX	0xFFFFu
 
 unsigned int
 hb_ot_layout_table_get_script_tags (hb_face_t    *face,
diff --git a/src/hb-ot-map-private.hh b/src/hb-ot-map-private.hh
index 74e2d9a..86b7e9f 100644
--- a/src/hb-ot-map-private.hh
+++ b/src/hb-ot-map-private.hh
@@ -153,10 +153,10 @@ struct hb_ot_map_t
 };
 
 enum hb_ot_map_feature_flags_t {
-  F_NONE		= 0x0000,
-  F_GLOBAL		= 0x0001,
-  F_HAS_FALLBACK	= 0x0002,
-  F_MANUAL_ZWJ		= 0x0004
+  F_NONE		= 0x0000u,
+  F_GLOBAL		= 0x0001u,
+  F_HAS_FALLBACK	= 0x0002u,
+  F_MANUAL_ZWJ		= 0x0004u
 };
 /* Macro version for where const is desired. */
 #define F_COMBINE(l,r) (hb_ot_map_feature_flags_t ((unsigned int) (l) | (unsigned int) (r)))
diff --git a/src/hb-ot-maxp-table.hh b/src/hb-ot-maxp-table.hh
index e6d2555..b1f8328 100644
--- a/src/hb-ot-maxp-table.hh
+++ b/src/hb-ot-maxp-table.hh
@@ -50,13 +50,13 @@ struct maxp
   inline bool sanitize (hb_sanitize_context_t *c) {
     TRACE_SANITIZE (this);
     return TRACE_RETURN (c->check_struct (this) &&
-			 likely (version.major == 1 || (version.major == 0 && version.minor == 0x5000)));
+			 likely (version.major == 1 || (version.major == 0 && version.minor == 0x5000u)));
   }
 
   /* We only implement version 0.5 as none of the extra fields in version 1.0 are useful. */
   protected:
   FixedVersion	version;		/* Version of the maxp table (0.5 or 1.0),
-					 * 0x00005000 or 0x00010000. */
+					 * 0x00005000u or 0x00010000u. */
   USHORT	numGlyphs;		/* The number of glyphs in the font. */
   public:
   DEFINE_SIZE_STATIC (6);
diff --git a/src/hb-ot-shape-complex-arabic-fallback.hh b/src/hb-ot-shape-complex-arabic-fallback.hh
index 6b2b87e..2d8488e 100644
--- a/src/hb-ot-shape-complex-arabic-fallback.hh
+++ b/src/hb-ot-shape-complex-arabic-fallback.hh
@@ -71,7 +71,7 @@ arabic_fallback_synthesize_lookup_single (const hb_ot_shape_plan_t *plan HB_UNUS
 	!hb_font_get_glyph (font, u, 0, &u_glyph) ||
 	!hb_font_get_glyph (font, s, 0, &s_glyph) ||
 	u_glyph == s_glyph ||
-	u_glyph > 0xFFFF || s_glyph > 0xFFFF)
+	u_glyph > 0xFFFFu || s_glyph > 0xFFFFu)
       continue;
 
     glyphs[num_glyphs].set (u_glyph);
diff --git a/src/hb-ot-shape-complex-hangul.cc b/src/hb-ot-shape-complex-hangul.cc
index 47aa44f..54c12eb 100644
--- a/src/hb-ot-shape-complex-hangul.cc
+++ b/src/hb-ot-shape-complex-hangul.cc
@@ -86,26 +86,26 @@ data_destroy_hangul (void *data)
 }
 
 /* Constants for algorithmic hangul syllable [de]composition. */
-#define LBase 0x1100
-#define VBase 0x1161
-#define TBase 0x11A7
-#define LCount 19
-#define VCount 21
-#define TCount 28
-#define SBase 0xAC00
+#define LBase 0x1100u
+#define VBase 0x1161u
+#define TBase 0x11A7u
+#define LCount 19u
+#define VCount 21u
+#define TCount 28u
+#define SBase 0xAC00u
 #define NCount (VCount * TCount)
 #define SCount (LCount * NCount)
 
-#define isCombiningL(u) (hb_in_range<hb_codepoint_t> ((u), LBase, LBase+LCount-1))
-#define isCombiningV(u) (hb_in_range<hb_codepoint_t> ((u), VBase, VBase+VCount-1))
-#define isCombiningT(u) (hb_in_range<hb_codepoint_t> ((u), TBase+1, TBase+TCount-1))
-#define isCombinedS(u) (hb_in_range<hb_codepoint_t> ((u), SBase, SBase+SCount-1))
+#define isCombiningL(u) (hb_in_range ((u), LBase, LBase+LCount-1))
+#define isCombiningV(u) (hb_in_range ((u), VBase, VBase+VCount-1))
+#define isCombiningT(u) (hb_in_range ((u), TBase+1, TBase+TCount-1))
+#define isCombinedS(u) (hb_in_range ((u), SBase, SBase+SCount-1))
 
-#define isL(u) (hb_in_ranges<hb_codepoint_t> ((u), 0x1100, 0x115F, 0xA960, 0xA97C))
-#define isV(u) (hb_in_ranges<hb_codepoint_t> ((u), 0x1160, 0x11A7, 0xD7B0, 0xD7C6))
-#define isT(u) (hb_in_ranges<hb_codepoint_t> ((u), 0x11A8, 0x11FF, 0xD7CB, 0xD7FB))
+#define isL(u) (hb_in_ranges ((u), 0x1100u, 0x115Fu, 0xA960u, 0xA97Cu))
+#define isV(u) (hb_in_ranges ((u), 0x1160u, 0x11A7u, 0xD7B0u, 0xD7C6u))
+#define isT(u) (hb_in_ranges ((u), 0x11A8u, 0x11FFu, 0xD7CBu, 0xD7FBu))
 
-#define isHangulTone(u) (hb_in_range<hb_codepoint_t> ((u), 0x302e, 0x302f))
+#define isHangulTone(u) (hb_in_range ((u), 0x302Eu, 0x302Fu))
 
 /* buffer var allocations */
 #define hangul_shaping_feature() complex_var_u8_0() /* hangul jamo shaping feature */
@@ -211,14 +211,14 @@ preprocess_text_hangul (const hb_ot_shape_plan_t *plan,
       else
       {
 	/* No valid syllable as base for tone mark; try to insert dotted circle. */
-	if (font->has_glyph (0x25cc))
+	if (font->has_glyph (0x25CCu))
 	{
 	  hb_codepoint_t chars[2];
 	  if (!is_zero_width_char (font, u)) {
 	    chars[0] = u;
-	    chars[1] = 0x25cc;
+	    chars[1] = 0x25CCu;
 	  } else {
-	    chars[0] = 0x25cc;
+	    chars[0] = 0x25CCu;
 	    chars[1] = u;
 	  }
 	  buffer->replace_glyphs (1, 2, chars);
diff --git a/src/hb-ot-shape-complex-hebrew.cc b/src/hb-ot-shape-complex-hebrew.cc
index 6bb6043..2381a6e 100644
--- a/src/hb-ot-shape-complex-hebrew.cc
+++ b/src/hb-ot-shape-complex-hebrew.cc
@@ -35,37 +35,37 @@ compose_hebrew (const hb_ot_shape_normalize_context_t *c,
 {
   /* Hebrew presentation-form shaping.
    * https://bugzilla.mozilla.org/show_bug.cgi?id=728866
-   * Hebrew presentation forms with dagesh, for characters 0x05D0..0x05EA;
+   * Hebrew presentation forms with dagesh, for characters U+05D0..05EA;
    * Note that some letters do not have a dagesh presForm encoded.
    */
-  static const hb_codepoint_t sDageshForms[0x05EA - 0x05D0 + 1] = {
-    0xFB30, /* ALEF */
-    0xFB31, /* BET */
-    0xFB32, /* GIMEL */
-    0xFB33, /* DALET */
-    0xFB34, /* HE */
-    0xFB35, /* VAV */
-    0xFB36, /* ZAYIN */
-    0x0000, /* HET */
-    0xFB38, /* TET */
-    0xFB39, /* YOD */
-    0xFB3A, /* FINAL KAF */
-    0xFB3B, /* KAF */
-    0xFB3C, /* LAMED */
-    0x0000, /* FINAL MEM */
-    0xFB3E, /* MEM */
-    0x0000, /* FINAL NUN */
-    0xFB40, /* NUN */
-    0xFB41, /* SAMEKH */
-    0x0000, /* AYIN */
-    0xFB43, /* FINAL PE */
-    0xFB44, /* PE */
-    0x0000, /* FINAL TSADI */
-    0xFB46, /* TSADI */
-    0xFB47, /* QOF */
-    0xFB48, /* RESH */
-    0xFB49, /* SHIN */
-    0xFB4A /* TAV */
+  static const hb_codepoint_t sDageshForms[0x05EAu - 0x05D0u + 1] = {
+    0xFB30u, /* ALEF */
+    0xFB31u, /* BET */
+    0xFB32u, /* GIMEL */
+    0xFB33u, /* DALET */
+    0xFB34u, /* HE */
+    0xFB35u, /* VAV */
+    0xFB36u, /* ZAYIN */
+    0x0000u, /* HET */
+    0xFB38u, /* TET */
+    0xFB39u, /* YOD */
+    0xFB3Au, /* FINAL KAF */
+    0xFB3Bu, /* KAF */
+    0xFB3Cu, /* LAMED */
+    0x0000u, /* FINAL MEM */
+    0xFB3Eu, /* MEM */
+    0x0000u, /* FINAL NUN */
+    0xFB40u, /* NUN */
+    0xFB41u, /* SAMEKH */
+    0x0000u, /* AYIN */
+    0xFB43u, /* FINAL PE */
+    0xFB44u, /* PE */
+    0x0000u, /* FINAL TSADI */
+    0xFB46u, /* TSADI */
+    0xFB47u, /* QOF */
+    0xFB48u, /* RESH */
+    0xFB49u, /* SHIN */
+    0xFB4Au /* TAV */
   };
 
   bool found = c->unicode->compose (a, b, ab);
@@ -75,76 +75,76 @@ compose_hebrew (const hb_ot_shape_normalize_context_t *c,
       /* Special-case Hebrew presentation forms that are excluded from
        * standard normalization, but wanted for old fonts. */
       switch (b) {
-      case 0x05B4: /* HIRIQ */
-	  if (a == 0x05D9) { /* YOD */
-	      *ab = 0xFB1D;
+      case 0x05B4u: /* HIRIQ */
+	  if (a == 0x05D9u) { /* YOD */
+	      *ab = 0xFB1Du;
 	      found = true;
 	  }
 	  break;
-      case 0x05B7: /* patah */
-	  if (a == 0x05F2) { /* YIDDISH YOD YOD */
-	      *ab = 0xFB1F;
+      case 0x05B7u: /* patah */
+	  if (a == 0x05F2u) { /* YIDDISH YOD YOD */
+	      *ab = 0xFB1Fu;
 	      found = true;
-	  } else if (a == 0x05D0) { /* ALEF */
-	      *ab = 0xFB2E;
+	  } else if (a == 0x05D0u) { /* ALEF */
+	      *ab = 0xFB2Eu;
 	      found = true;
 	  }
 	  break;
-      case 0x05B8: /* QAMATS */
-	  if (a == 0x05D0) { /* ALEF */
-	      *ab = 0xFB2F;
+      case 0x05B8u: /* QAMATS */
+	  if (a == 0x05D0u) { /* ALEF */
+	      *ab = 0xFB2Fu;
 	      found = true;
 	  }
 	  break;
-      case 0x05B9: /* HOLAM */
-	  if (a == 0x05D5) { /* VAV */
-	      *ab = 0xFB4B;
+      case 0x05B9u: /* HOLAM */
+	  if (a == 0x05D5u) { /* VAV */
+	      *ab = 0xFB4Bu;
 	      found = true;
 	  }
 	  break;
-      case 0x05BC: /* DAGESH */
-	  if (a >= 0x05D0 && a <= 0x05EA) {
-	      *ab = sDageshForms[a - 0x05D0];
+      case 0x05BCu: /* DAGESH */
+	  if (a >= 0x05D0u && a <= 0x05EAu) {
+	      *ab = sDageshForms[a - 0x05D0u];
 	      found = (*ab != 0);
-	  } else if (a == 0xFB2A) { /* SHIN WITH SHIN DOT */
-	      *ab = 0xFB2C;
+	  } else if (a == 0xFB2Au) { /* SHIN WITH SHIN DOT */
+	      *ab = 0xFB2Cu;
 	      found = true;
-	  } else if (a == 0xFB2B) { /* SHIN WITH SIN DOT */
-	      *ab = 0xFB2D;
+	  } else if (a == 0xFB2Bu) { /* SHIN WITH SIN DOT */
+	      *ab = 0xFB2Du;
 	      found = true;
 	  }
 	  break;
-      case 0x05BF: /* RAFE */
+      case 0x05BFu: /* RAFE */
 	  switch (a) {
-	  case 0x05D1: /* BET */
-	      *ab = 0xFB4C;
+	  case 0x05D1u: /* BET */
+	      *ab = 0xFB4Cu;
 	      found = true;
 	      break;
-	  case 0x05DB: /* KAF */
-	      *ab = 0xFB4D;
+	  case 0x05DBu: /* KAF */
+	      *ab = 0xFB4Du;
 	      found = true;
 	      break;
-	  case 0x05E4: /* PE */
-	      *ab = 0xFB4E;
+	  case 0x05E4u: /* PE */
+	      *ab = 0xFB4Eu;
 	      found = true;
 	      break;
 	  }
 	  break;
-      case 0x05C1: /* SHIN DOT */
-	  if (a == 0x05E9) { /* SHIN */
-	      *ab = 0xFB2A;
+      case 0x05C1u: /* SHIN DOT */
+	  if (a == 0x05E9u) { /* SHIN */
+	      *ab = 0xFB2Au;
 	      found = true;
-	  } else if (a == 0xFB49) { /* SHIN WITH DAGESH */
-	      *ab = 0xFB2C;
+	  } else if (a == 0xFB49u) { /* SHIN WITH DAGESH */
+	      *ab = 0xFB2Cu;
 	      found = true;
 	  }
 	  break;
-      case 0x05C2: /* SIN DOT */
-	  if (a == 0x05E9) { /* SHIN */
-	      *ab = 0xFB2B;
+      case 0x05C2u: /* SIN DOT */
+	  if (a == 0x05E9u) { /* SHIN */
+	      *ab = 0xFB2Bu;
 	      found = true;
-	  } else if (a == 0xFB49) { /* SHIN WITH DAGESH */
-	      *ab = 0xFB2D;
+	  } else if (a == 0xFB49u) { /* SHIN WITH DAGESH */
+	      *ab = 0xFB2Du;
 	      found = true;
 	  }
 	  break;
diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc
index 1100b4a..02087a0 100644
--- a/src/hb-ot-shape-complex-indic.cc
+++ b/src/hb-ot-shape-complex-indic.cc
@@ -37,19 +37,19 @@
  */
 
 
-#define IN_HALF_BLOCK(u, Base) (((u) & ~0x7F) == (Base))
+#define IN_HALF_BLOCK(u, Base) (((u) & ~0x7Fu) == (Base))
 
-#define IS_DEVA(u) (IN_HALF_BLOCK (u, 0x0900))
-#define IS_BENG(u) (IN_HALF_BLOCK (u, 0x0980))
-#define IS_GURU(u) (IN_HALF_BLOCK (u, 0x0A00))
-#define IS_GUJR(u) (IN_HALF_BLOCK (u, 0x0A80))
-#define IS_ORYA(u) (IN_HALF_BLOCK (u, 0x0B00))
-#define IS_TAML(u) (IN_HALF_BLOCK (u, 0x0B80))
-#define IS_TELU(u) (IN_HALF_BLOCK (u, 0x0C00))
-#define IS_KNDA(u) (IN_HALF_BLOCK (u, 0x0C80))
-#define IS_MLYM(u) (IN_HALF_BLOCK (u, 0x0D00))
-#define IS_SINH(u) (IN_HALF_BLOCK (u, 0x0D80))
-#define IS_KHMR(u) (IN_HALF_BLOCK (u, 0x1780))
+#define IS_DEVA(u) (IN_HALF_BLOCK (u, 0x0900u))
+#define IS_BENG(u) (IN_HALF_BLOCK (u, 0x0980u))
+#define IS_GURU(u) (IN_HALF_BLOCK (u, 0x0A00u))
+#define IS_GUJR(u) (IN_HALF_BLOCK (u, 0x0A80u))
+#define IS_ORYA(u) (IN_HALF_BLOCK (u, 0x0B00u))
+#define IS_TAML(u) (IN_HALF_BLOCK (u, 0x0B80u))
+#define IS_TELU(u) (IN_HALF_BLOCK (u, 0x0C00u))
+#define IS_KNDA(u) (IN_HALF_BLOCK (u, 0x0C80u))
+#define IS_MLYM(u) (IN_HALF_BLOCK (u, 0x0D00u))
+#define IS_SINH(u) (IN_HALF_BLOCK (u, 0x0D80u))
+#define IS_KHMR(u) (IN_HALF_BLOCK (u, 0x1780u))
 
 
 #define MATRA_POS_LEFT(u)	POS_PRE_M
@@ -60,8 +60,8 @@
 				  IS_GUJR(u) ? POS_AFTER_POST : \
 				  IS_ORYA(u) ? POS_AFTER_POST : \
 				  IS_TAML(u) ? POS_AFTER_POST : \
-				  IS_TELU(u) ? (u <= 0x0C42 ? POS_BEFORE_SUB : POS_AFTER_SUB) : \
-				  IS_KNDA(u) ? (u < 0x0CC3 || u > 0xCD6 ? POS_BEFORE_SUB : POS_AFTER_SUB) : \
+				  IS_TELU(u) ? (u <= 0x0C42u ? POS_BEFORE_SUB : POS_AFTER_SUB) : \
+				  IS_KNDA(u) ? (u < 0x0CC3u || u > 0xCD6u ? POS_BEFORE_SUB : POS_AFTER_SUB) : \
 				  IS_MLYM(u) ? POS_AFTER_POST : \
 				  IS_SINH(u) ? POS_AFTER_SUB  : \
 				  IS_KHMR(u) ? POS_AFTER_POST : \
@@ -112,20 +112,20 @@ matra_position (hb_codepoint_t u, indic_position_t side)
  * Or completely remove it and just check in the tables.
  */
 static const hb_codepoint_t ra_chars[] = {
-  0x0930, /* Devanagari */
-  0x09B0, /* Bengali */
-  0x09F0, /* Bengali */
-  0x0A30, /* Gurmukhi */	/* No Reph */
-  0x0AB0, /* Gujarati */
-  0x0B30, /* Oriya */
-  0x0BB0, /* Tamil */		/* No Reph */
-  0x0C30, /* Telugu */		/* Reph formed only with ZWJ */
-  0x0CB0, /* Kannada */
-  0x0D30, /* Malayalam */	/* No Reph, Logical Repha */
-
-  0x0DBB, /* Sinhala */		/* Reph formed only with ZWJ */
-
-  0x179A, /* Khmer */		/* No Reph, Visual Repha */
+  0x0930u, /* Devanagari */
+  0x09B0u, /* Bengali */
+  0x09F0u, /* Bengali */
+  0x0A30u, /* Gurmukhi */	/* No Reph */
+  0x0AB0u, /* Gujarati */
+  0x0B30u, /* Oriya */
+  0x0BB0u, /* Tamil */		/* No Reph */
+  0x0C30u, /* Telugu */		/* Reph formed only with ZWJ */
+  0x0CB0u, /* Kannada */
+  0x0D30u, /* Malayalam */	/* No Reph, Logical Repha */
+
+  0x0DBBu, /* Sinhala */		/* Reph formed only with ZWJ */
+
+  0x179Au, /* Khmer */		/* No Reph, Visual Repha */
 };
 
 static inline bool
@@ -168,7 +168,7 @@ set_indic_properties (hb_glyph_info_t &info)
 {
   hb_codepoint_t u = info.codepoint;
   unsigned int type = hb_indic_get_categories (u);
-  indic_category_t cat = (indic_category_t) (type & 0x7F);
+  indic_category_t cat = (indic_category_t) (type & 0x7Fu);
   indic_position_t pos = (indic_position_t) (type >> 8);
 
 
@@ -187,50 +187,50 @@ set_indic_properties (hb_glyph_info_t &info)
    * U+092E,U+0951,U+0952
    * U+092E,U+0952,U+0951
    */
-  if (unlikely (hb_in_ranges<hb_codepoint_t> (u, 0x0951, 0x0952,
-						 0x1CD0, 0x1CD2,
-						 0x1CD4, 0x1CE1) ||
-					    u == 0x1CF4))
+  if (unlikely (hb_in_ranges (u, 0x0951u, 0x0952u,
+				 0x1CD0u, 0x1CD2u,
+				 0x1CD4u, 0x1CE1u) ||
+			    u == 0x1CF4u))
     cat = OT_A;
   /* The following act more like the Bindus. */
-  else if (unlikely (hb_in_range<hb_codepoint_t> (u, 0x0953, 0x0954)))
+  else if (unlikely (hb_in_range (u, 0x0953u, 0x0954u)))
     cat = OT_SM;
   /* The following act like consonants. */
-  else if (unlikely (hb_in_ranges<hb_codepoint_t> (u, 0x0A72, 0x0A73,
-						      0x1CF5, 0x1CF6)))
+  else if (unlikely (hb_in_ranges (u, 0x0A72u, 0x0A73u,
+				      0x1CF5u, 0x1CF6u)))
     cat = OT_C;
   /* TODO: The following should only be allowed after a Visarga.
    * For now, just treat them like regular tone marks. */
-  else if (unlikely (hb_in_range<hb_codepoint_t> (u, 0x1CE2, 0x1CE8)))
+  else if (unlikely (hb_in_range (u, 0x1CE2u, 0x1CE8u)))
     cat = OT_A;
   /* TODO: The following should only be allowed after some of
    * the nasalization marks, maybe only for U+1CE9..U+1CF1.
    * For now, just treat them like tone marks. */
-  else if (unlikely (u == 0x1CED))
+  else if (unlikely (u == 0x1CEDu))
     cat = OT_A;
   /* The following take marks in standalone clusters, similar to Avagraha. */
-  else if (unlikely (hb_in_ranges<hb_codepoint_t> (u, 0xA8F2, 0xA8F7,
-						      0x1CE9, 0x1CEC,
-						      0x1CEE, 0x1CF1)))
+  else if (unlikely (hb_in_ranges (u, 0xA8F2u, 0xA8F7u,
+				      0x1CE9u, 0x1CECu,
+				      0x1CEEu, 0x1CF1u)))
   {
     cat = OT_Symbol;
     ASSERT_STATIC ((int) INDIC_SYLLABIC_CATEGORY_AVAGRAHA == OT_Symbol);
   }
-  else if (unlikely (hb_in_range<hb_codepoint_t> (u, 0x17CD, 0x17D1) ||
-		     u == 0x17CB || u == 0x17D3 || u == 0x17DD)) /* Khmer Various signs */
+  else if (unlikely (hb_in_range (u, 0x17CDu, 0x17D1u) ||
+		     u == 0x17CBu || u == 0x17D3u || u == 0x17DDu)) /* Khmer Various signs */
   {
     /* These are like Top Matras. */
     cat = OT_M;
     pos = POS_ABOVE_C;
   }
-  else if (unlikely (u == 0x17C6)) cat = OT_N; /* Khmer Bindu doesn't like to be repositioned. */
-  else if (unlikely (u == 0x17D2)) cat = OT_Coeng; /* Khmer coeng */
-  else if (unlikely (hb_in_range<hb_codepoint_t> (u, 0x2010, 0x2011)))
-				   cat = OT_PLACEHOLDER;
-  else if (unlikely (u == 0x25CC)) cat = OT_DOTTEDCIRCLE;
-  else if (unlikely (u == 0xA982)) cat = OT_SM; /* Javanese repha. */
-  else if (unlikely (u == 0xA9BE)) cat = OT_CM2; /* Javanese medial ya. */
-  else if (unlikely (u == 0xA9BD)) { cat = OT_M; pos = POS_POST_C; } /* Javanese vocalic r. */
+  else if (unlikely (u == 0x17C6u)) cat = OT_N; /* Khmer Bindu doesn't like to be repositioned. */
+  else if (unlikely (u == 0x17D2u)) cat = OT_Coeng; /* Khmer coeng */
+  else if (unlikely (hb_in_range (u, 0x2010u, 0x2011u)))
+				    cat = OT_PLACEHOLDER;
+  else if (unlikely (u == 0x25CCu)) cat = OT_DOTTEDCIRCLE;
+  else if (unlikely (u == 0xA982u)) cat = OT_SM; /* Javanese repha. */
+  else if (unlikely (u == 0xA9BEu)) cat = OT_CM2; /* Javanese medial ya. */
+  else if (unlikely (u == 0xA9BDu)) { cat = OT_M; pos = POS_POST_C; } /* Javanese vocalic r. */
 
 
   /*
@@ -252,7 +252,7 @@ set_indic_properties (hb_glyph_info_t &info)
     pos = POS_SMVD;
   }
 
-  if (unlikely (u == 0x0B01)) pos = POS_BEFORE_SUB; /* Oriya Bindu is BeforeSub in the spec. */
+  if (unlikely (u == 0x0B01u)) pos = POS_BEFORE_SUB; /* Oriya Bindu is BeforeSub in the spec. */
 
 
 
@@ -316,20 +316,20 @@ struct indic_config_t
 static const indic_config_t indic_configs[] =
 {
   /* Default.  Should be first. */
-  {HB_SCRIPT_INVALID,	false,     0,BASE_POS_LAST, REPH_POS_BEFORE_POST,REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_1},
-  {HB_SCRIPT_DEVANAGARI,true, 0x094D,BASE_POS_LAST, REPH_POS_BEFORE_POST,REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE},
-  {HB_SCRIPT_BENGALI,	true, 0x09CD,BASE_POS_LAST, REPH_POS_AFTER_SUB,  REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE},
-  {HB_SCRIPT_GURMUKHI,	true, 0x0A4D,BASE_POS_LAST, REPH_POS_BEFORE_SUB, REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE},
-  {HB_SCRIPT_GUJARATI,	true, 0x0ACD,BASE_POS_LAST, REPH_POS_BEFORE_POST,REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE},
-  {HB_SCRIPT_ORIYA,	true, 0x0B4D,BASE_POS_LAST, REPH_POS_AFTER_MAIN, REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE},
-  {HB_SCRIPT_TAMIL,	true, 0x0BCD,BASE_POS_LAST, REPH_POS_AFTER_POST, REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_2},
-  {HB_SCRIPT_TELUGU,	true, 0x0C4D,BASE_POS_LAST, REPH_POS_AFTER_POST, REPH_MODE_EXPLICIT, BLWF_MODE_POST_ONLY,    PREF_LEN_2},
-  {HB_SCRIPT_KANNADA,	true, 0x0CCD,BASE_POS_LAST, REPH_POS_AFTER_POST, REPH_MODE_IMPLICIT, BLWF_MODE_POST_ONLY,    PREF_LEN_2},
-  {HB_SCRIPT_MALAYALAM,	true, 0x0D4D,BASE_POS_LAST, REPH_POS_AFTER_MAIN, REPH_MODE_LOG_REPHA,BLWF_MODE_PRE_AND_POST, PREF_LEN_2},
-  {HB_SCRIPT_SINHALA,	false,0x0DCA,BASE_POS_LAST_SINHALA,
-						    REPH_POS_AFTER_MAIN, REPH_MODE_EXPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE},
-  {HB_SCRIPT_KHMER,	false,0x17D2,BASE_POS_FIRST,REPH_POS_DONT_CARE,  REPH_MODE_VIS_REPHA,BLWF_MODE_PRE_AND_POST, PREF_LEN_2},
-  {HB_SCRIPT_JAVANESE,	false,0xA9C0,BASE_POS_FIRST,REPH_POS_DONT_CARE,  REPH_MODE_VIS_REPHA,BLWF_MODE_PRE_AND_POST, PREF_LEN_1},
+  {HB_SCRIPT_INVALID,	false,      0,BASE_POS_LAST, REPH_POS_BEFORE_POST,REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_1},
+  {HB_SCRIPT_DEVANAGARI,true, 0x094Du,BASE_POS_LAST, REPH_POS_BEFORE_POST,REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE},
+  {HB_SCRIPT_BENGALI,	true, 0x09CDu,BASE_POS_LAST, REPH_POS_AFTER_SUB,  REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE},
+  {HB_SCRIPT_GURMUKHI,	true, 0x0A4Du,BASE_POS_LAST, REPH_POS_BEFORE_SUB, REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE},
+  {HB_SCRIPT_GUJARATI,	true, 0x0ACDu,BASE_POS_LAST, REPH_POS_BEFORE_POST,REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE},
+  {HB_SCRIPT_ORIYA,	true, 0x0B4Du,BASE_POS_LAST, REPH_POS_AFTER_MAIN, REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE},
+  {HB_SCRIPT_TAMIL,	true, 0x0BCDu,BASE_POS_LAST, REPH_POS_AFTER_POST, REPH_MODE_IMPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_2},
+  {HB_SCRIPT_TELUGU,	true, 0x0C4Du,BASE_POS_LAST, REPH_POS_AFTER_POST, REPH_MODE_EXPLICIT, BLWF_MODE_POST_ONLY,    PREF_LEN_2},
+  {HB_SCRIPT_KANNADA,	true, 0x0CCDu,BASE_POS_LAST, REPH_POS_AFTER_POST, REPH_MODE_IMPLICIT, BLWF_MODE_POST_ONLY,    PREF_LEN_2},
+  {HB_SCRIPT_MALAYALAM,	true, 0x0D4Du,BASE_POS_LAST, REPH_POS_AFTER_MAIN, REPH_MODE_LOG_REPHA,BLWF_MODE_PRE_AND_POST, PREF_LEN_2},
+  {HB_SCRIPT_SINHALA,	false,0x0DCAu,BASE_POS_LAST_SINHALA,
+						     REPH_POS_AFTER_MAIN, REPH_MODE_EXPLICIT, BLWF_MODE_PRE_AND_POST, PREF_LEN_DONT_CARE},
+  {HB_SCRIPT_KHMER,	false,0x17D2u,BASE_POS_FIRST,REPH_POS_DONT_CARE,  REPH_MODE_VIS_REPHA,BLWF_MODE_PRE_AND_POST, PREF_LEN_2},
+  {HB_SCRIPT_JAVANESE,	false,0xA9C0u,BASE_POS_FIRST,REPH_POS_DONT_CARE,  REPH_MODE_VIS_REPHA,BLWF_MODE_PRE_AND_POST, PREF_LEN_1},
 };
 
 
@@ -553,7 +553,7 @@ data_create_indic (const hb_ot_shape_plan_t *plan)
       break;
     }
 
-  indic_plan->is_old_spec = indic_plan->config->has_old_spec && ((plan->map.chosen_script[0] & 0x000000FF) != '2');
+  indic_plan->is_old_spec = indic_plan->config->has_old_spec && ((plan->map.chosen_script[0] & 0x000000FFu) != '2');
   indic_plan->virama_glyph = (hb_codepoint_t) -1;
 
   /* Use zero-context would_substitute() matching for new-spec of the main
@@ -1238,11 +1238,11 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED,
 
 
   hb_codepoint_t dottedcircle_glyph;
-  if (!font->get_glyph (0x25CC, 0, &dottedcircle_glyph))
+  if (!font->get_glyph (0x25CCu, 0, &dottedcircle_glyph))
     return;
 
   hb_glyph_info_t dottedcircle = {0};
-  dottedcircle.codepoint = 0x25CC;
+  dottedcircle.codepoint = 0x25CCu;
   set_indic_properties (dottedcircle);
   dottedcircle.codepoint = dottedcircle_glyph;
 
@@ -1749,37 +1749,37 @@ decompose_indic (const hb_ot_shape_normalize_context_t *c,
   switch (ab)
   {
     /* Don't decompose these. */
-    case 0x0931  : return false;
-    case 0x0B94  : return false;
+    case 0x0931u  : return false;
+    case 0x0B94u  : return false;
 
 
     /*
      * Decompose split matras that don't have Unicode decompositions.
      */
 
-    case 0x0F77  : *a = 0x0FB2; *b= 0x0F81; return true;
-    case 0x0F79  : *a = 0x0FB3; *b= 0x0F81; return true;
-    case 0x17BE  : *a = 0x17C1; *b= 0x17BE; return true;
-    case 0x17BF  : *a = 0x17C1; *b= 0x17BF; return true;
-    case 0x17C0  : *a = 0x17C1; *b= 0x17C0; return true;
-    case 0x17C4  : *a = 0x17C1; *b= 0x17C4; return true;
-    case 0x17C5  : *a = 0x17C1; *b= 0x17C5; return true;
-    case 0x1925  : *a = 0x1920; *b= 0x1923; return true;
-    case 0x1926  : *a = 0x1920; *b= 0x1924; return true;
-    case 0x1B3C  : *a = 0x1B42; *b= 0x1B3C; return true;
-    case 0x1112E  : *a = 0x11127; *b= 0x11131; return true;
-    case 0x1112F  : *a = 0x11127; *b= 0x11132; return true;
+    case 0x0F77u  : *a = 0x0FB2u; *b= 0x0F81u; return true;
+    case 0x0F79u  : *a = 0x0FB3u; *b= 0x0F81u; return true;
+    case 0x17BEu  : *a = 0x17C1u; *b= 0x17BEu; return true;
+    case 0x17BFu  : *a = 0x17C1u; *b= 0x17BFu; return true;
+    case 0x17C0u  : *a = 0x17C1u; *b= 0x17C0u; return true;
+    case 0x17C4u  : *a = 0x17C1u; *b= 0x17C4u; return true;
+    case 0x17C5u  : *a = 0x17C1u; *b= 0x17C5u; return true;
+    case 0x1925u  : *a = 0x1920u; *b= 0x1923u; return true;
+    case 0x1926u  : *a = 0x1920u; *b= 0x1924u; return true;
+    case 0x1B3Cu  : *a = 0x1B42u; *b= 0x1B3Cu; return true;
+    case 0x1112Eu  : *a = 0x11127u; *b= 0x11131u; return true;
+    case 0x1112Fu  : *a = 0x11127u; *b= 0x11132u; return true;
 #if 0
     /* This one has no decomposition in Unicode, but needs no decomposition either. */
-    /* case 0x0AC9  : return false; */
-    case 0x0B57  : *a = no decomp, -> RIGHT; return true;
-    case 0x1C29  : *a = no decomp, -> LEFT; return true;
-    case 0xA9C0  : *a = no decomp, -> RIGHT; return true;
-    case 0x111BF  : *a = no decomp, -> ABOVE; return true;
+    /* case 0x0AC9u  : return false; */
+    case 0x0B57u  : *a = no decomp, -> RIGHT; return true;
+    case 0x1C29u  : *a = no decomp, -> LEFT; return true;
+    case 0xA9C0u  : *a = no decomp, -> RIGHT; return true;
+    case 0x111BuF  : *a = no decomp, -> ABOVE; return true;
 #endif
   }
 
-  if ((ab == 0x0DDA || hb_in_range<hb_codepoint_t> (ab, 0x0DDC, 0x0DDE)))
+  if ((ab == 0x0DDAu || hb_in_range (ab, 0x0DDCu, 0x0DDEu)))
   {
     /*
      * Sinhala split matras...  Let the fun begin.
@@ -1816,7 +1816,7 @@ decompose_indic (const hb_ot_shape_normalize_context_t *c,
 	 indic_plan->pstf.would_substitute (&glyph, 1, c->font->face)))
     {
       /* Ok, safe to use Uniscribe-style decomposition. */
-      *a = 0x0DD9;
+      *a = 0x0DD9u;
       *b = ab;
       return true;
     }
@@ -1836,7 +1836,7 @@ compose_indic (const hb_ot_shape_normalize_context_t *c,
     return false;
 
   /* Composition-exclusion exceptions that we want to recompose. */
-  if (a == 0x09AF && b == 0x09BC) { *ab = 0x09DF; return true; }
+  if (a == 0x09AFu && b == 0x09BCu) { *ab = 0x09DFu; return true; }
 
   return c->unicode->compose (a, b, ab);
 }
diff --git a/src/hb-ot-shape-complex-myanmar.cc b/src/hb-ot-shape-complex-myanmar.cc
index ae5446a..8b2c00c 100644
--- a/src/hb-ot-shape-complex-myanmar.cc
+++ b/src/hb-ot-shape-complex-myanmar.cc
@@ -169,80 +169,80 @@ set_myanmar_properties (hb_glyph_info_t &info)
 {
   hb_codepoint_t u = info.codepoint;
   unsigned int type = hb_indic_get_categories (u);
-  indic_category_t cat = (indic_category_t) (type & 0x7F);
+  indic_category_t cat = (indic_category_t) (type & 0x7Fu);
   indic_position_t pos = (indic_position_t) (type >> 8);
 
   /* Myanmar
    * http://www.microsoft.com/typography/OpenTypeDev/myanmar/intro.htm#analyze
    */
-  if (unlikely (hb_in_range<hb_codepoint_t> (u, 0xFE00, 0xFE0F)))
+  if (unlikely (hb_in_range (u, 0xFE00u, 0xFE0Fu)))
     cat = (indic_category_t) OT_VS;
 
   switch (u)
   {
-    case 0x104E:
+    case 0x104Eu:
       cat = (indic_category_t) OT_C; /* The spec says C, IndicSyllableCategory doesn't have. */
       break;
 
-    case 0x002D: case 0x00A0: case 0x00D7: case 0x2012:
-    case 0x2013: case 0x2014: case 0x2015: case 0x2022:
-    case 0x25CC: case 0x25FB: case 0x25FC: case 0x25FD:
-    case 0x25FE:
+    case 0x002Du: case 0x00A0u: case 0x00D7u: case 0x2012u:
+    case 0x2013u: case 0x2014u: case 0x2015u: case 0x2022u:
+    case 0x25CCu: case 0x25FBu: case 0x25FCu: case 0x25FDu:
+    case 0x25FEu:
       cat = (indic_category_t) OT_GB;
       break;
 
-    case 0x1004: case 0x101B: case 0x105A:
+    case 0x1004u: case 0x101Bu: case 0x105Au:
       cat = (indic_category_t) OT_Ra;
       break;
 
-    case 0x1032: case 0x1036:
+    case 0x1032u: case 0x1036u:
       cat = (indic_category_t) OT_A;
       break;
 
-    case 0x103A:
+    case 0x103Au:
       cat = (indic_category_t) OT_As;
       break;
 
-    case 0x1041: case 0x1042: case 0x1043: case 0x1044:
-    case 0x1045: case 0x1046: case 0x1047: case 0x1048:
-    case 0x1049: case 0x1090: case 0x1091: case 0x1092:
-    case 0x1093: case 0x1094: case 0x1095: case 0x1096:
-    case 0x1097: case 0x1098: case 0x1099:
+    case 0x1041u: case 0x1042u: case 0x1043u: case 0x1044u:
+    case 0x1045u: case 0x1046u: case 0x1047u: case 0x1048u:
+    case 0x1049u: case 0x1090u: case 0x1091u: case 0x1092u:
+    case 0x1093u: case 0x1094u: case 0x1095u: case 0x1096u:
+    case 0x1097u: case 0x1098u: case 0x1099u:
       cat = (indic_category_t) OT_D;
       break;
 
-    case 0x1040:
+    case 0x1040u:
       cat = (indic_category_t) OT_D; /* XXX The spec says D0, but Uniscribe doesn't seem to do. */
       break;
 
-    case 0x103E: case 0x1060:
+    case 0x103Eu: case 0x1060u:
       cat = (indic_category_t) OT_MH;
       break;
 
-    case 0x103C:
+    case 0x103Cu:
       cat = (indic_category_t) OT_MR;
       break;
 
-    case 0x103D: case 0x1082:
+    case 0x103Du: case 0x1082u:
       cat = (indic_category_t) OT_MW;
       break;
 
-    case 0x103B: case 0x105E: case 0x105F:
+    case 0x103Bu: case 0x105Eu: case 0x105Fu:
       cat = (indic_category_t) OT_MY;
       break;
 
-    case 0x1063: case 0x1064: case 0x1069: case 0x106A:
-    case 0x106B: case 0x106C: case 0x106D: case 0xAA7B:
+    case 0x1063u: case 0x1064u: case 0x1069u: case 0x106Au:
+    case 0x106Bu: case 0x106Cu: case 0x106Du: case 0xAA7Bu:
       cat = (indic_category_t) OT_PT;
       break;
 
-    case 0x1038: case 0x1087: case 0x1088: case 0x1089:
-    case 0x108A: case 0x108B: case 0x108C: case 0x108D:
-    case 0x108F: case 0x109A: case 0x109B: case 0x109C:
+    case 0x1038u: case 0x1087u: case 0x1088u: case 0x1089u:
+    case 0x108Au: case 0x108Bu: case 0x108Cu: case 0x108Du:
+    case 0x108Fu: case 0x109Au: case 0x109Bu: case 0x109Cu:
       cat = (indic_category_t) OT_SM;
       break;
 
-    case 0x104A: case 0x104B:
+    case 0x104Au: case 0x104Bu:
       cat = (indic_category_t) OT_P;
       break;
   }
@@ -461,11 +461,11 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED,
 
 
   hb_codepoint_t dottedcircle_glyph;
-  if (!font->get_glyph (0x25CC, 0, &dottedcircle_glyph))
+  if (!font->get_glyph (0x25CCu, 0, &dottedcircle_glyph))
     return;
 
   hb_glyph_info_t dottedcircle = {0};
-  dottedcircle.codepoint = 0x25CC;
+  dottedcircle.codepoint = 0x25CCu;
   set_myanmar_properties (dottedcircle);
   dottedcircle.codepoint = dottedcircle_glyph;
 
diff --git a/src/hb-ot-shape-complex-sea.cc b/src/hb-ot-shape-complex-sea.cc
index 6288a90..a4adb8f 100644
--- a/src/hb-ot-shape-complex-sea.cc
+++ b/src/hb-ot-shape-complex-sea.cc
@@ -139,11 +139,11 @@ set_sea_properties (hb_glyph_info_t &info)
 {
   hb_codepoint_t u = info.codepoint;
   unsigned int type = hb_indic_get_categories (u);
-  indic_category_t cat = (indic_category_t) (type & 0x7F);
+  indic_category_t cat = (indic_category_t) (type & 0x7Fu);
   indic_position_t pos = (indic_position_t) (type >> 8);
 
   /* Medial Ra */
-  if (u == 0x1A55 || u == 0xAA34)
+  if (u == 0x1A55u || u == 0xAA34u)
     cat = (indic_category_t) OT_MR;
 
   if (cat == OT_M)
@@ -288,11 +288,11 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED,
 
 
   hb_codepoint_t dottedcircle_glyph;
-  if (!font->get_glyph (0x25CC, 0, &dottedcircle_glyph))
+  if (!font->get_glyph (0x25CCu, 0, &dottedcircle_glyph))
     return;
 
   hb_glyph_info_t dottedcircle = {0};
-  dottedcircle.codepoint = 0x25CC;
+  dottedcircle.codepoint = 0x25CCu;
   set_sea_properties (dottedcircle);
   dottedcircle.codepoint = dottedcircle_glyph;
 
diff --git a/src/hb-ot-shape-complex-thai.cc b/src/hb-ot-shape-complex-thai.cc
index cb9a7d9..feb7fc7 100644
--- a/src/hb-ot-shape-complex-thai.cc
+++ b/src/hb-ot-shape-complex-thai.cc
@@ -46,13 +46,13 @@ enum thai_consonant_type_t
 static thai_consonant_type_t
 get_consonant_type (hb_codepoint_t u)
 {
-  if (u == 0x0E1B || u == 0x0E1D || u == 0x0E1F/* || u == 0x0E2C*/)
+  if (u == 0x0E1Bu || u == 0x0E1Du || u == 0x0E1Fu/* || u == 0x0E2Cu*/)
     return AC;
-  if (u == 0x0E0D || u == 0x0E10)
+  if (u == 0x0E0Du || u == 0x0E10u)
     return RC;
-  if (u == 0x0E0E || u == 0x0E0F)
+  if (u == 0x0E0Eu || u == 0x0E0Fu)
     return DC;
-  if (hb_in_range<hb_codepoint_t> (u, 0x0E01, 0x0E2E))
+  if (hb_in_range (u, 0x0E01u, 0x0E2Eu))
     return NC;
   return NOT_CONSONANT;
 }
@@ -70,12 +70,12 @@ enum thai_mark_type_t
 static thai_mark_type_t
 get_mark_type (hb_codepoint_t u)
 {
-  if (u == 0x0E31 || hb_in_range<hb_codepoint_t> (u, 0x0E34, 0x0E37) ||
-      u == 0x0E47 || hb_in_range<hb_codepoint_t> (u, 0x0E4D, 0x0E4E))
+  if (u == 0x0E31u || hb_in_range (u, 0x0E34u, 0x0E37u) ||
+      u == 0x0E47u || hb_in_range (u, 0x0E4Du, 0x0E4Eu))
     return AV;
-  if (hb_in_range<hb_codepoint_t> (u, 0x0E38, 0x0E3A))
+  if (hb_in_range (u, 0x0E38u, 0x0E3Au))
     return BV;
-  if (hb_in_range<hb_codepoint_t> (u, 0x0E48, 0x0E4C))
+  if (hb_in_range (u, 0x0E48u, 0x0E4Cu))
     return T;
   return NOT_MARK;
 }
@@ -99,43 +99,43 @@ thai_pua_shape (hb_codepoint_t u, thai_action_t action, hb_font_t *font)
     hb_codepoint_t mac_pua;
   } const *pua_mappings = NULL;
   static const thai_pua_mapping_t SD_mappings[] = {
-    {0x0E48, 0xF70A, 0xF88B}, /* MAI EK */
-    {0x0E49, 0xF70B, 0xF88E}, /* MAI THO */
-    {0x0E4A, 0xF70C, 0xF891}, /* MAI TRI */
-    {0x0E4B, 0xF70D, 0xF894}, /* MAI CHATTAWA */
-    {0x0E4C, 0xF70E, 0xF897}, /* THANTHAKHAT */
-    {0x0E38, 0xF718, 0xF89B}, /* SARA U */
-    {0x0E39, 0xF719, 0xF89C}, /* SARA UU */
-    {0x0E3A, 0xF71A, 0xF89D}, /* PHINTHU */
-    {0x0000, 0x0000, 0x0000}
+    {0x0E48u, 0xF70Au, 0xF88Bu}, /* MAI EK */
+    {0x0E49u, 0xF70Bu, 0xF88Eu}, /* MAI THO */
+    {0x0E4Au, 0xF70Cu, 0xF891u}, /* MAI TRI */
+    {0x0E4Bu, 0xF70Du, 0xF894u}, /* MAI CHATTAWA */
+    {0x0E4Cu, 0xF70Eu, 0xF897u}, /* THANTHAKHAT */
+    {0x0E38u, 0xF718u, 0xF89Bu}, /* SARA U */
+    {0x0E39u, 0xF719u, 0xF89Cu}, /* SARA UU */
+    {0x0E3Au, 0xF71Au, 0xF89Du}, /* PHINTHU */
+    {0x0000u, 0x0000u, 0x0000u}
   };
   static const thai_pua_mapping_t SDL_mappings[] = {
-    {0x0E48, 0xF705, 0xF88C}, /* MAI EK */
-    {0x0E49, 0xF706, 0xF88F}, /* MAI THO */
-    {0x0E4A, 0xF707, 0xF892}, /* MAI TRI */
-    {0x0E4B, 0xF708, 0xF895}, /* MAI CHATTAWA */
-    {0x0E4C, 0xF709, 0xF898}, /* THANTHAKHAT */
-    {0x0000, 0x0000, 0x0000}
+    {0x0E48u, 0xF705u, 0xF88Cu}, /* MAI EK */
+    {0x0E49u, 0xF706u, 0xF88Fu}, /* MAI THO */
+    {0x0E4Au, 0xF707u, 0xF892u}, /* MAI TRI */
+    {0x0E4Bu, 0xF708u, 0xF895u}, /* MAI CHATTAWA */
+    {0x0E4Cu, 0xF709u, 0xF898u}, /* THANTHAKHAT */
+    {0x0000u, 0x0000u, 0x0000u}
   };
   static const thai_pua_mapping_t SL_mappings[] = {
-    {0x0E48, 0xF713, 0xF88A}, /* MAI EK */
-    {0x0E49, 0xF714, 0xF88D}, /* MAI THO */
-    {0x0E4A, 0xF715, 0xF890}, /* MAI TRI */
-    {0x0E4B, 0xF716, 0xF893}, /* MAI CHATTAWA */
-    {0x0E4C, 0xF717, 0xF896}, /* THANTHAKHAT */
-    {0x0E31, 0xF710, 0xF884}, /* MAI HAN-AKAT */
-    {0x0E34, 0xF701, 0xF885}, /* SARA I */
-    {0x0E35, 0xF702, 0xF886}, /* SARA II */
-    {0x0E36, 0xF703, 0xF887}, /* SARA UE */
-    {0x0E37, 0xF704, 0xF888}, /* SARA UEE */
-    {0x0E47, 0xF712, 0xF889}, /* MAITAIKHU */
-    {0x0E4D, 0xF711, 0xF899}, /* NIKHAHIT */
-    {0x0000, 0x0000, 0x0000}
+    {0x0E48u, 0xF713u, 0xF88Au}, /* MAI EK */
+    {0x0E49u, 0xF714u, 0xF88Du}, /* MAI THO */
+    {0x0E4Au, 0xF715u, 0xF890u}, /* MAI TRI */
+    {0x0E4Bu, 0xF716u, 0xF893u}, /* MAI CHATTAWA */
+    {0x0E4Cu, 0xF717u, 0xF896u}, /* THANTHAKHAT */
+    {0x0E31u, 0xF710u, 0xF884u}, /* MAI HAN-AKAT */
+    {0x0E34u, 0xF701u, 0xF885u}, /* SARA I */
+    {0x0E35u, 0xF702u, 0xF886u}, /* SARA II */
+    {0x0E36u, 0xF703u, 0xF887u}, /* SARA UE */
+    {0x0E37u, 0xF704u, 0xF888u}, /* SARA UEE */
+    {0x0E47u, 0xF712u, 0xF889u}, /* MAITAIKHU */
+    {0x0E4Du, 0xF711u, 0xF899u}, /* NIKHAHIT */
+    {0x0000u, 0x0000u, 0x0000u}
   };
   static const thai_pua_mapping_t RD_mappings[] = {
-    {0x0E0D, 0xF70F, 0xF89A}, /* YO YING */
-    {0x0E10, 0xF700, 0xF89E}, /* THO THAN */
-    {0x0000, 0x0000, 0x0000}
+    {0x0E0Du, 0xF70Fu, 0xF89Au}, /* YO YING */
+    {0x0E10u, 0xF700u, 0xF89Eu}, /* THO THAN */
+    {0x0000u, 0x0000u, 0x0000u}
   };
 
   switch (action) {
@@ -308,10 +308,10 @@ preprocess_text_thai (const hb_ot_shape_plan_t *plan,
 
   /* We only get one script at a time, so a script-agnostic implementation
    * is adequate here. */
-#define IS_SARA_AM(x) (((x) & ~0x0080) == 0x0E33)
-#define NIKHAHIT_FROM_SARA_AM(x) ((x) - 0xE33 + 0xE4D)
+#define IS_SARA_AM(x) (((x) & ~0x0080u) == 0x0E33u)
+#define NIKHAHIT_FROM_SARA_AM(x) ((x) - 0x0E33u + 0x0E4Du)
 #define SARA_AA_FROM_SARA_AM(x) ((x) - 1)
-#define IS_TONE_MARK(x) (hb_in_ranges<hb_codepoint_t> ((x) & ~0x0080, 0x0E34, 0x0E37, 0x0E47, 0x0E4E, 0x0E31, 0x0E31))
+#define IS_TONE_MARK(x) (hb_in_ranges ((x) & ~0x0080u, 0x0E34u, 0x0E37u, 0x0E47u, 0x0E4Eu, 0x0E31u, 0x0E31u))
 
   buffer->clear_output ();
   unsigned int count = buffer->len;
diff --git a/src/hb-ot-shape-fallback.cc b/src/hb-ot-shape-fallback.cc
index 5d526c3..89eab28 100644
--- a/src/hb-ot-shape-fallback.cc
+++ b/src/hb-ot-shape-fallback.cc
@@ -35,42 +35,42 @@ recategorize_combining_class (hb_codepoint_t u,
     return klass;
 
   /* Thai / Lao need some per-character work. */
-  if ((u & ~0xFF) == 0x0E00)
+  if ((u & ~0xFF) == 0x0E00u)
   {
     if (unlikely (klass == 0))
     {
       switch (u)
       {
-        case 0x0E31:
-        case 0x0E34:
-        case 0x0E35:
-        case 0x0E36:
-        case 0x0E37:
-        case 0x0E47:
-        case 0x0E4C:
-        case 0x0E4D:
-        case 0x0E4E:
+        case 0x0E31u:
+        case 0x0E34u:
+        case 0x0E35u:
+        case 0x0E36u:
+        case 0x0E37u:
+        case 0x0E47u:
+        case 0x0E4Cu:
+        case 0x0E4Du:
+        case 0x0E4Eu:
 	  klass = HB_UNICODE_COMBINING_CLASS_ABOVE_RIGHT;
 	  break;
 
-        case 0x0EB1:
-        case 0x0EB4:
-        case 0x0EB5:
-        case 0x0EB6:
-        case 0x0EB7:
-        case 0x0EBB:
-        case 0x0ECC:
-        case 0x0ECD:
+        case 0x0EB1u:
+        case 0x0EB4u:
+        case 0x0EB5u:
+        case 0x0EB6u:
+        case 0x0EB7u:
+        case 0x0EBBu:
+        case 0x0ECCu:
+        case 0x0ECDu:
 	  klass = HB_UNICODE_COMBINING_CLASS_ABOVE;
 	  break;
 
-        case 0x0EBC:
+        case 0x0EBCu:
 	  klass = HB_UNICODE_COMBINING_CLASS_BELOW;
 	  break;
       }
     } else {
       /* Thai virama is below-right */
-      if (u == 0x0E3A)
+      if (u == 0x0E3Au)
 	klass = HB_UNICODE_COMBINING_CLASS_BELOW_RIGHT;
     }
   }
diff --git a/src/hb-ot-shape-normalize.cc b/src/hb-ot-shape-normalize.cc
index 0d2f8f5..7a9f24c 100644
--- a/src/hb-ot-shape-normalize.cc
+++ b/src/hb-ot-shape-normalize.cc
@@ -213,7 +213,7 @@ decompose_current_character (const hb_ot_shape_normalize_context_t *c, bool shor
     /* Not found, not decomposible;  If codepoint is invalid Unicode and
      * font supports U+FFFD REPLACEMENT CHARACTER, use that instead. */
     hb_codepoint_t FFFD_glyph;
-    if (buffer->cur().codepoint > 0x10FFFF && c->font->get_glyph (0xFFFD, 0, &FFFD_glyph))
+    if (buffer->cur().codepoint > 0x10FFFFu && c->font->get_glyph (0xFFFDu, 0, &FFFD_glyph))
       glyph = FFFD_glyph;
     next_char (buffer, glyph); /* glyph is initialized in earlier branches. */
   }
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 42f68ab..bc9eaa5 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -238,11 +238,11 @@ hb_insert_dotted_circle (hb_buffer_t *buffer, hb_font_t *font)
       HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
     return;
 
-  if (!font->has_glyph (0x25CC))
+  if (!font->has_glyph (0x25CCu))
     return;
 
   hb_glyph_info_t dottedcircle;
-  dottedcircle.codepoint = 0x25CC;
+  dottedcircle.codepoint = 0x25CCu;
   _hb_glyph_info_set_unicode_props (&dottedcircle, buffer->unicode);
 
   buffer->clear_output ();
@@ -321,7 +321,7 @@ hb_ot_shape_setup_masks_fraction (hb_ot_shape_context_t *c)
   hb_glyph_info_t *info = buffer->info;
   for (unsigned int i = 0; i < count; i++)
   {
-    if (info[i].codepoint == 0x2044) /* FRACTION SLASH */
+    if (info[i].codepoint == 0x2044u) /* FRACTION SLASH */
     {
       unsigned int start = i, end = i + 1;
       while (start &&
diff --git a/src/hb-ot-tag.cc b/src/hb-ot-tag.cc
index 89cc1e2..878dd79 100644
--- a/src/hb-ot-tag.cc
+++ b/src/hb-ot-tag.cc
@@ -57,7 +57,7 @@ hb_ot_old_tag_from_script (hb_script_t script)
   }
 
   /* Else, just change first char to lowercase and return */
-  return ((hb_tag_t) script) | 0x20000000;
+  return ((hb_tag_t) script) | 0x20000000u;
 }
 
 static hb_script_t
@@ -70,13 +70,13 @@ hb_ot_old_tag_to_script (hb_tag_t tag)
 
   /* Any spaces at the end of the tag are replaced by repeating the last
    * letter.  Eg 'nko ' -> 'Nkoo' */
-  if (unlikely ((tag & 0x0000FF00) == 0x00002000))
-    tag |= (tag >> 8) & 0x0000FF00; /* Copy second letter to third */
-  if (unlikely ((tag & 0x000000FF) == 0x00000020))
-    tag |= (tag >> 8) & 0x000000FF; /* Copy third letter to fourth */
+  if (unlikely ((tag & 0x0000FF00u) == 0x00002000u))
+    tag |= (tag >> 8) & 0x0000FF00u; /* Copy second letter to third */
+  if (unlikely ((tag & 0x000000FFu) == 0x00000020u))
+    tag |= (tag >> 8) & 0x000000FFu; /* Copy third letter to fourth */
 
   /* Change first char to uppercase and return */
-  return (hb_script_t) (tag & ~0x20000000);
+  return (hb_script_t) (tag & ~0x20000000u);
 }
 
 static hb_tag_t
@@ -146,7 +146,7 @@ hb_ot_tags_from_script (hb_script_t  script,
 hb_script_t
 hb_ot_tag_to_script (hb_tag_t tag)
 {
-  if (unlikely ((tag & 0x000000FF) == '2'))
+  if (unlikely ((tag & 0x000000FFu) == '2'))
     return hb_ot_new_tag_to_script (tag);
 
   return hb_ot_old_tag_to_script (tag);
@@ -858,7 +858,7 @@ hb_ot_tag_from_language (hb_language_t language)
     s = lang_str + strlen (lang_str);
   if (s - lang_str == 3) {
     /* Assume it's ISO-639-3 and upper-case and use it. */
-    return hb_tag_from_string (lang_str, s - lang_str) & ~0x20202000;
+    return hb_tag_from_string (lang_str, s - lang_str) & ~0x20202000u;
   }
 
   return HB_OT_TAG_DEFAULT_LANGUAGE;
@@ -877,7 +877,7 @@ hb_ot_tag_to_language (hb_tag_t tag)
       return hb_language_from_string (ot_languages[i].language, -1);
 
   /* If tag starts with ZH, it's Chinese */
-  if ((tag & 0xFFFF0000)  == 0x5A480000) {
+  if ((tag & 0xFFFF0000u)  == 0x5A480000u) {
     switch (tag) {
       case HB_TAG('Z','H','H',' '): return hb_language_from_string ("zh-hk", -1); /* Hong Kong */
       case HB_TAG('Z','H','S',' '): return hb_language_from_string ("zh-Hans", -1); /* Simplified */
diff --git a/src/hb-unicode-private.hh b/src/hb-unicode-private.hh
index 583a197..31a7abb 100644
--- a/src/hb-unicode-private.hh
+++ b/src/hb-unicode-private.hh
@@ -106,15 +106,15 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
   modified_combining_class (hb_codepoint_t unicode)
   {
     /* XXX This hack belongs to the Myanmar shaper. */
-    if (unlikely (unicode == 0x1037)) unicode = 0x103A;
+    if (unlikely (unicode == 0x1037u)) unicode = 0x103Au;
 
     /* XXX This hack belongs to the SEA shaper (for Tai Tham):
      * Reorder SAKOT to ensure it comes after any tone marks. */
-    if (unlikely (unicode == 0x1A60)) return 254;
+    if (unlikely (unicode == 0x1A60u)) return 254;
 
     /* XXX This hack belongs to the Tibetan shaper:
      * Reorder PADMA to ensure it comes after any vowel marks. */
-    if (unlikely (unicode == 0x0FC6)) return 254;
+    if (unlikely (unicode == 0x0FC6u)) return 254;
 
     return _hb_modified_combining_class[combining_class (unicode)];
   }
@@ -122,10 +122,10 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
   inline hb_bool_t
   is_variation_selector (hb_codepoint_t unicode)
   {
-    return unlikely (hb_in_ranges<hb_codepoint_t> (unicode,
-						   0x180B, 0x180D, /* MONGOLIAN FREE VARIATION SELECTOR ONE..THREE */
-						   0xFE00, 0xFE0F, /* VARIATION SELECTOR-1..16 */
-						   0xE0100, 0xE01EF));  /* VARIATION SELECTOR-17..256 */
+    return unlikely (hb_in_ranges (unicode,
+				   0x180Bu, 0x180Du, /* MONGOLIAN FREE VARIATION SELECTOR ONE..THREE */
+				   0xFE00u, 0xFE0Fu, /* VARIATION SELECTOR-1..16 */
+				   0xE0100u, 0xE01EFu));  /* VARIATION SELECTOR-17..256 */
   }
 
   /* Default_Ignorable codepoints:
@@ -173,16 +173,16 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
       /* BMP */
       hb_codepoint_t page = ch >> 8;
       switch (page) {
-	case 0x00: return unlikely (ch == 0x00AD);
-	case 0x03: return unlikely (ch == 0x034F);
-	case 0x06: return unlikely (ch == 0x061C);
-	case 0x17: return hb_in_range<hb_codepoint_t> (ch, 0x17B4, 0x17B5);
-	case 0x18: return hb_in_range<hb_codepoint_t> (ch, 0x180B, 0x180E);
-	case 0x20: return hb_in_ranges<hb_codepoint_t> (ch, 0x200B, 0x200F,
-							    0x202A, 0x202E,
-							    0x2060, 0x206F);
-	case 0xFE: return hb_in_range<hb_codepoint_t> (ch, 0xFE00, 0xFE0F) || ch == 0xFEFF;
-	case 0xFF: return hb_in_range<hb_codepoint_t> (ch, 0xFFF0, 0xFFF8);
+	case 0x00: return unlikely (ch == 0x00ADu);
+	case 0x03: return unlikely (ch == 0x034Fu);
+	case 0x06: return unlikely (ch == 0x061Cu);
+	case 0x17: return hb_in_range (ch, 0x17B4u, 0x17B5u);
+	case 0x18: return hb_in_range (ch, 0x180Bu, 0x180Eu);
+	case 0x20: return hb_in_ranges (ch, 0x200Bu, 0x200Fu,
+							    0x202Au, 0x202Eu,
+							    0x2060u, 0x206Fu);
+	case 0xFE: return hb_in_range (ch, 0xFE00u, 0xFE0Fu) || ch == 0xFEFFu;
+	case 0xFF: return hb_in_range (ch, 0xFFF0u, 0xFFF8u);
 	default: return false;
       }
     }
@@ -190,9 +190,9 @@ HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS_SIMPLE
     {
       /* Other planes */
       switch (plane) {
-	case 0x01: return hb_in_ranges<hb_codepoint_t> (ch, 0x0001BCA0, 0x0001BCA3,
-							    0x0001D173, 0x0001D17A);
-	case 0x0E: return hb_in_range<hb_codepoint_t> (ch, 0x000E0000, 0x000E0FFF);
+	case 0x01: return hb_in_ranges (ch, 0x1BCA0u, 0x1BCA3u,
+					    0x1D173u, 0x1D17Au);
+	case 0x0E: return hb_in_range (ch, 0xE0000u, 0xE0FFFu);
 	default: return false;
       }
     }
diff --git a/src/hb-uniscribe.cc b/src/hb-uniscribe.cc
index f699415..6bdf0f5 100644
--- a/src/hb-uniscribe.cc
+++ b/src/hb-uniscribe.cc
@@ -379,7 +379,7 @@ _hb_rename_font (hb_blob_t *blob, wchar_t *new_name)
     OT::NameRecord &record = name.nameRecord[i];
     record.platformID.set (3);
     record.encodingID.set (1);
-    record.languageID.set (0x0409); /* English */
+    record.languageID.set (0x0409u); /* English */
     record.nameID.set (name_IDs[i]);
     record.length.set (name_str_len * 2);
     record.offset.set (0);
@@ -749,13 +749,13 @@ retry:
   {
     hb_codepoint_t c = buffer->info[i].codepoint;
     buffer->info[i].utf16_index() = chars_len;
-    if (likely (c < 0x10000))
+    if (likely (c <= 0xFFFFu))
       pchars[chars_len++] = c;
-    else if (unlikely (c >= 0x110000))
-      pchars[chars_len++] = 0xFFFD;
+    else if (unlikely (c > 0x10FFFFu))
+      pchars[chars_len++] = 0xFFFDu;
     else {
-      pchars[chars_len++] = 0xD800 + ((c - 0x10000) >> 10);
-      pchars[chars_len++] = 0xDC00 + ((c - 0x10000) & ((1 << 10) - 1));
+      pchars[chars_len++] = 0xD800u + ((c - 0x10000u) >> 10);
+      pchars[chars_len++] = 0xDC00u + ((c - 0x10000u) & ((1 << 10) - 1));
     }
   }
 
@@ -771,7 +771,7 @@ retry:
       hb_codepoint_t c = buffer->info[i].codepoint;
       unsigned int cluster = buffer->info[i].cluster;
       log_clusters[chars_len++] = cluster;
-      if (c >= 0x10000 && c < 0x110000)
+      if (hb_in_range (c, 0x10000u, 0x10FFFFu))
 	log_clusters[chars_len++] = cluster; /* Surrogates. */
     }
   }
diff --git a/src/hb-utf-private.hh b/src/hb-utf-private.hh
index fece185..bfb3a80 100644
--- a/src/hb-utf-private.hh
+++ b/src/hb-utf-private.hh
@@ -105,20 +105,20 @@ hb_utf_next (const uint16_t *text,
 {
   hb_codepoint_t c = *text++;
 
-  if (likely (!hb_in_range<hb_codepoint_t> (c, 0xd800, 0xdfff)))
+  if (likely (!hb_in_range (c, 0xD800u, 0xDFFFu)))
   {
     *unicode = c;
     return text;
   }
 
-  if (likely (hb_in_range<hb_codepoint_t> (c, 0xd800, 0xdbff)))
+  if (likely (hb_in_range (c, 0xD800u, 0xDBFFu)))
   {
     /* High-surrogate in c */
     hb_codepoint_t l;
-    if (text < end && ((l = *text), likely (hb_in_range<hb_codepoint_t> (l, 0xdc00, 0xdfff))))
+    if (text < end && ((l = *text), likely (hb_in_range (l, 0xDC00u, 0xDFFFu))))
     {
       /* Low-surrogate in l */
-      *unicode = (c << 10) + l - ((0xd800 << 10) - 0x10000 + 0xdc00);
+      *unicode = (c << 10) + l - ((0xD800u << 10) - 0x10000u + 0xDC00u);
        text++;
        return text;
     }
@@ -136,20 +136,20 @@ hb_utf_prev (const uint16_t *text,
 {
   hb_codepoint_t c = *--text;
 
-  if (likely (!hb_in_range<hb_codepoint_t> (c, 0xd800, 0xdfff)))
+  if (likely (!hb_in_range (c, 0xD800u, 0xDFFFu)))
   {
     *unicode = c;
     return text;
   }
 
-  if (likely (hb_in_range<hb_codepoint_t> (c, 0xdc00, 0xdfff)))
+  if (likely (hb_in_range (c, 0xDC00u, 0xDFFFu)))
   {
     /* Low-surrogate in c */
     hb_codepoint_t h;
-    if (start < text && ((h = *(text - 1)), likely (hb_in_range<hb_codepoint_t> (h, 0xd800, 0xdbff))))
+    if (start < text && ((h = *(text - 1)), likely (hb_in_range (h, 0xD800u, 0xDBFFu))))
     {
       /* High-surrogate in h */
-      *unicode = (h << 10) + c - ((0xd800 << 10) - 0x10000 + 0xdc00);
+      *unicode = (h << 10) + c - ((0xD800u << 10) - 0x10000u + 0xDC00u);
        text--;
        return text;
     }
commit a8b89a09f6d3a3466282aae07fd65e143f9f8f83
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Jul 11 14:18:01 2014 -0400

    Simplify hb_in_range()
    
    It's both faster and produces smaller code.  Now I feel stupid for
    not writing it this way before.

diff --git a/src/hb-private.hh b/src/hb-private.hh
index f2f580a..fb07e24 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -786,20 +786,16 @@ struct hb_auto_trace_t<0, ret_t> {
 
 /* Misc */
 
+template <typename T> class hb_assert_unsigned_t;
+template <> class hb_assert_unsigned_t<unsigned char> {};
+template <> class hb_assert_unsigned_t<unsigned int> {};
+template <> class hb_assert_unsigned_t<unsigned long> {};
 
-/* Pre-mature optimization:
- * Checks for lo <= u <= hi but with an optimization if lo and hi
- * are only different in a contiguous set of lower-most bits.
- */
 template <typename T> static inline bool
 hb_in_range (T u, T lo, T hi)
 {
-  if ( ((lo^hi) & lo) == 0 &&
-       ((lo^hi) & hi) == (lo^hi) &&
-       ((lo^hi) & ((lo^hi) + 1)) == 0 )
-    return (u & ~(lo^hi)) == lo;
-  else
-    return lo <= u && u <= hi;
+  hb_assert_unsigned_t<T> error_hb_in_range_called_with_signed_type HB_UNUSED;
+  return (u - lo) <= (hi - lo);
 }
 
 template <typename T> static inline bool
commit db8934faa1854dafaf4c4ce34d1818e12f67ef52
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Fri Jul 11 13:58:36 2014 -0400

    Simplify hb_utf_prev<8> to call hb_utf_next<8>

diff --git a/src/hb-utf-private.hh b/src/hb-utf-private.hh
index 11f23cc..fece185 100644
--- a/src/hb-utf-private.hh
+++ b/src/hb-utf-private.hh
@@ -81,27 +81,11 @@ hb_utf_prev (const uint8_t *text,
   while (start < text && (*text & 0xc0) == 0x80 && end - text < 4)
     text--;
 
-  hb_codepoint_t c = *text, mask;
-  unsigned int len;
-
-  /* TODO check for overlong sequences? */
-
-  HB_UTF8_COMPUTE (c, mask, len);
-  if (unlikely (!len || (unsigned int) (end - text) != len)) {
-    *unicode = -1;
-    return end - 1;
-  } else {
-    hb_codepoint_t result;
-    unsigned int i;
-    result = c & mask;
-    for (i = 1; i < len; i++)
-      {
-	result <<= 6;
-	result |= (text[i] & 0x3f);
-      }
-    *unicode = result;
+  if (likely (hb_utf_next (text, end, unicode) == end))
     return text;
-  }
+
+  *unicode = -1;
+  return end - 1;
 }
 
 


More information about the HarfBuzz mailing list