diff options
author | Kartik Agaram <vc@akkartik.com> | 2019-07-09 16:48:46 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2019-07-09 16:55:37 -0700 |
commit | f6ea25613f80814a4fc9ff1185abcf5e908b7469 (patch) | |
tree | 86c037f706e8666b786a85efdc7f90bef81792a4 /subx | |
parent | 7a752f8d3df2f7123c4954ae960bb221ae9b4d68 (diff) | |
download | mu-f6ea25613f80814a4fc9ff1185abcf5e908b7469.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')
-rwxr-xr-x | subx/apps/survey | bin | 37321 -> 37321 bytes | |||
-rw-r--r-- | subx/apps/survey.subx | 28 |
2 files changed, 12 insertions, 16 deletions
diff --git a/subx/apps/survey b/subx/apps/survey index 3176f924..17fb88f4 100755 --- a/subx/apps/survey +++ b/subx/apps/survey Binary files differdiff --git a/subx/apps/survey.subx b/subx/apps/survey.subx index 532cd034..e6ab7e1d 100644 --- a/subx/apps/survey.subx +++ b/subx/apps/survey.subx @@ -444,20 +444,18 @@ $compute-offsets:word-loop: e8/call slice-empty?/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP - # . EAX == 1 ? - 3d/compare-EAX-and 1/imm32 - # . if so, break (go to top of outer loop) - 0f 84/jump-if-equal $compute-offsets:line-loop/disp32 + # . if (EAX != 0) break + 3d/compare-EAX-and 0/imm32 + 0f 85/jump-if-not-equal $compute-offsets:line-loop/disp32 # if slice-starts-with?(word-slice, "#") continue 68/push "#"/imm32 52/push-EDX e8/call slice-starts-with?/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP - # . EAX == 1 ? - 3d/compare-EAX-and 1/imm32 - # . if so, continue - 74/jump-if-equal $compute-offsets:word-loop/disp8 + # . if (EAX != 0) continue + 3d/compare-EAX-and 0/imm32 + 75/jump-if-not-equal $compute-offsets:word-loop/disp8 $compute-offsets:label: # if (!is-label?(word-slice/EDX)) goto next check # . EAX = is-label?(word-slice/EDX) @@ -564,10 +562,9 @@ $compute-offsets:construct-next-segment: e8/call slice-empty?/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP - # . EAX == 1 ? - 3d/compare-EAX-and 1/imm32 - # . if so, abort - 0f 84/jump-if-equal $compute-offsets:abort/disp32 + # . if (EAX != 0) abort + 3d/compare-EAX-and 0/imm32 + 0f 85/jump-if-not-equal $compute-offsets:abort/disp32 # next-word(line/ECX, segment-start) 68/push compute-offsets:segment-start/imm32 51/push-ECX @@ -580,10 +577,9 @@ $compute-offsets:construct-next-segment: e8/call slice-empty?/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP - # . EAX == 1 ? - 3d/compare-EAX-and 1/imm32 - # . if so, abort - 0f 84/jump-if-equal $compute-offsets:abort/disp32 + # . if (EAX != 0) abort + 3d/compare-EAX-and 0/imm32 + 0f 85/jump-if-not-equal $compute-offsets:abort/disp32 # seg/EBX = get-or-insert-slice(segments, curr-segment-name, row-size=16) # . . push args 68/push 0x10/imm32/row-size |