shithub: orca

Download patch

ref: 54851e4fe9333968553929a9b8396e1a82ad97d2
parent: 35741285dbdd48bc505bb23b6caaa204bda855e9
author: cancel <cancel@cancel.fm>
date: Sun Jan 26 01:52:54 EST 2020

Cleanup

--- a/sim.c
+++ b/sim.c
@@ -709,13 +709,10 @@
   PORT(0, 1, IN);
   PORT(1, 0, IN | OUT);
   Glyph g = PEEK(0, -1);
-  Isz rate = 1;
-  if (g != '.' && g != '*')
-    rate = (Isz)index_of(g);
-  Isz target = (Isz)index_of(PEEK(0, 1));
+  Isz rate = g == '.' || g == '*' ? 1 : (Isz)index_of(g);
+  Isz goal = (Isz)index_of(PEEK(0, 1));
   Isz val = (Isz)index_of(PEEK(1, 0));
-  Isz mod =
-      val <= target - rate ? rate : val >= target + rate ? -rate : target - val;
+  Isz mod = val <= goal - rate ? rate : val >= goal + rate ? -rate : goal - val;
   POKE(1, 0, glyph_of((Usz)(val + mod)));
 END_OPERATOR