shithub: orca

Download patch

ref: 21e1608d9939f4241470405cebc7202ab3cad50d
parent: dcd2b2462cc9080fed9813591c7a0fe3c0e0161f
author: cancel <cancel@cancel.fm>
date: Sat Dec 1 14:26:20 EST 2018

Cleanup

--- a/sim.c
+++ b/sim.c
@@ -15,22 +15,8 @@
 // Always returns 0 through (sizeof indexed_glyphs) - 1, and works on
 // capitalized glyphs as well. The index of the lower-cased glyph is returned
 // if the glyph is capitalized.
-#if 0
-inline static Glyph glyph_lowered(Glyph c) {
-  return (c >= 'A' && c <= 'Z') ? (char)(c - ('a' - 'A')) : c;
-}
+#if 1
 static Usz index_of(Glyph c) {
-  Glyph c0 = glyph_lowered(c);
-  if (c0 == '.')
-    return 0;
-  for (Usz i = 0; i < Glyphs_array_num; ++i) {
-    if (indexed_glyphs[i] == c0)
-      return i;
-  }
-  return 0;
-}
-#else
-static Usz index_of(Glyph c) {
   if (c == '.')
     return 0;
   if (c >= '0' && c <= '9')
@@ -48,6 +34,21 @@
     return 49;
   case '#':
     return 40;
+  }
+  return 0;
+}
+#else
+// Reference implementation
+inline static Glyph glyph_lowered(Glyph c) {
+  return (c >= 'A' && c <= 'Z') ? (char)(c - ('a' - 'A')) : c;
+}
+static Usz index_of(Glyph c) {
+  Glyph c0 = glyph_lowered(c);
+  if (c0 == '.')
+    return 0;
+  for (Usz i = 0; i < Glyphs_array_num; ++i) {
+    if (indexed_glyphs[i] == c0)
+      return i;
   }
   return 0;
 }