about summary refs log tree commit diff stats
path: root/subx/apps
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-07-08 00:15:32 -0700
committerKartik Agaram <vc@akkartik.com>2019-07-08 00:15:32 -0700
commit7af8f4e8f6f296f2ebdd11c0a46b0a6a55bcf2d9 (patch)
treefbffdcc88d7def2bc3bb283d7eb6578f43a332b4 /subx/apps
parent58b60a667e2fc4314332c901fc1d6c7ecd819b72 (diff)
downloadmu-7af8f4e8f6f296f2ebdd11c0a46b0a6a55bcf2d9.tar.gz
preserve truthiness of non-booleans
Everywhere we check if something is true, we check it by comparing
against 0, not 1.
Diffstat (limited to 'subx/apps')
-rwxr-xr-xsubx/apps/assortbin28723 -> 28723 bytes
-rwxr-xr-xsubx/apps/dquotesbin35032 -> 35032 bytes
-rwxr-xr-xsubx/apps/packbin43637 -> 43637 bytes
-rw-r--r--subx/apps/subx-common.subx24
-rwxr-xr-xsubx/apps/surveybin34274 -> 34274 bytes
5 files changed, 12 insertions, 12 deletions
diff --git a/subx/apps/assort b/subx/apps/assort
index 530ad9c6..10573301 100755
--- a/subx/apps/assort
+++ b/subx/apps/assort
Binary files differdiff --git a/subx/apps/dquotes b/subx/apps/dquotes
index 6483c2dd..6015a4c6 100755
--- a/subx/apps/dquotes
+++ b/subx/apps/dquotes
Binary files differdiff --git a/subx/apps/pack b/subx/apps/pack
index 08164496..73e680b7 100755
--- a/subx/apps/pack
+++ b/subx/apps/pack
Binary files differdiff --git a/subx/apps/subx-common.subx b/subx/apps/subx-common.subx
index 83b37e07..6ab82884 100644
--- a/subx/apps/subx-common.subx
+++ b/subx/apps/subx-common.subx
@@ -1187,10 +1187,10 @@ compute-width-of-slice: # s : (address slice) -> EAX : int
     e8/call  has-metadata?/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-    # . if EAX: return 4
-    3d/compare-EAX-and  1/imm32
+    # . if (EAX != 0) return 4
+    3d/compare-EAX-and  0/imm32
     b8/copy-to-EAX  4/imm32         # ZF is set, so we can overwrite EAX now
-    74/jump-if-equal  $compute-width-of-slice:end/disp8
+    75/jump-if-not-equal  $compute-width-of-slice:end/disp8
     # if (has-metadata?(word, "disp32")) return 4
     # . EAX = has-metadata?(word, "disp32")
     # . . push args
@@ -1200,10 +1200,10 @@ compute-width-of-slice: # s : (address slice) -> EAX : int
     e8/call  has-metadata?/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-    # . if EAX: return 4
-    3d/compare-EAX-and  1/imm32
+    # . if (EAX != 0) return 4
+    3d/compare-EAX-and  0/imm32
     b8/copy-to-EAX  4/imm32         # ZF is set, so we can overwrite EAX now
-    74/jump-if-equal  $compute-width-of-slice:end/disp8
+    75/jump-if-not-equal  $compute-width-of-slice:end/disp8
     # if (has-metadata?(word, "imm16")) return 2
     # . EAX = has-metadata?(word, "imm16")
     # . . push args
@@ -1213,10 +1213,10 @@ compute-width-of-slice: # s : (address slice) -> EAX : int
     e8/call  has-metadata?/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-    # . if EAX: return 2
-    3d/compare-EAX-and  1/imm32
+    # . if (EAX != 0) return 2
+    3d/compare-EAX-and  0/imm32
     b8/copy-to-EAX  2/imm32         # ZF is set, so we can overwrite EAX now
-    74/jump-if-equal  $compute-width-of-slice:end/disp8
+    75/jump-if-not-equal  $compute-width-of-slice:end/disp8
     # if (has-metadata?(word, "disp16")) return 2
     # . EAX = has-metadata?(word, "disp16")
     # . . push args
@@ -1226,10 +1226,10 @@ compute-width-of-slice: # s : (address slice) -> EAX : int
     e8/call  has-metadata?/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-    # . if EAX: return 2
-    3d/compare-EAX-and  1/imm32
+    # . if (EAX != 0) return 2
+    3d/compare-EAX-and  0/imm32
     b8/copy-to-EAX  2/imm32         # ZF is set, so we can overwrite EAX now
-    74/jump-if-equal  $compute-width-of-slice:end/disp8
+    75/jump-if-not-equal  $compute-width-of-slice:end/disp8
     # otherwise return 1
     b8/copy-to-EAX  1/imm32
 $compute-width-of-slice:end:
diff --git a/subx/apps/survey b/subx/apps/survey
index 1963710f..9979e237 100755
--- a/subx/apps/survey
+++ b/subx/apps/survey
Binary files differ