diff options
author | Kartik Agaram <vc@akkartik.com> | 2019-03-20 17:08:43 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2019-03-20 17:33:42 -0700 |
commit | 4068f0ca5b3a380790794a986897815d8b6a45a8 (patch) | |
tree | 3549ac214d5f2dfe6321ec4bc81f45b8d79b925d /subx/072slice.subx | |
parent | 5c21976b5837484264b26557013e3b9264b4ee89 (diff) | |
download | mu-4068f0ca5b3a380790794a986897815d8b6a45a8.tar.gz |
5011
New convention: compare 'with' for asymmetric comparisons (greater or lesser than), and compare 'and' for symmetric comparisons. Worth making this distinction even though the opcodes are identical; when we compare 'with', the order of operands is significant.
Diffstat (limited to 'subx/072slice.subx')
-rw-r--r-- | subx/072slice.subx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/subx/072slice.subx b/subx/072slice.subx index 0e3d0c00..1e2a5db0 100644 --- a/subx/072slice.subx +++ b/subx/072slice.subx @@ -25,7 +25,7 @@ slice-empty?: # s : (address slice) -> EAX : boolean # if (s->start == s->end) return true # . EAX = s->start 8b/copy 0/mod/indirect 1/rm32/ECX . . . 0/r32/EAX . . # copy *ECX to EAX - # . compare EAX with s->end + # . compare EAX and s->end 39/compare 1/mod/*+disp8 1/rm32/ECX . . . 0/r32/EAX 4/disp8 . # compare EAX and *(ECX+4) b8/copy-to-EAX 1/imm32/true 74/jump-if-equal $slice-empty?:end/disp8 @@ -144,7 +144,7 @@ slice-equal?: # s : (address slice), p : (address string) -> EAX : boolean 31/xor 3/mod/direct 1/rm32/ECX . . . 1/r32/ECX . . # clear ECX $slice-equal?:loop: # if (currs >= maxs) return true - 39/compare 3/mod/direct 2/rm32/EDX . . . 6/r32/ESI . . # compare EDX and ESI + 39/compare 3/mod/direct 2/rm32/EDX . . . 6/r32/ESI . . # compare EDX with ESI 7d/jump-if-greater-or-equal $slice-equal?:true/disp8 # AL = *currp 8a/copy-byte 0/mod/indirect 3/rm32/EBX . . . 0/r32/AL . . # copy byte at *EBX to AL |