diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-01-27 00:36:44 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-01-27 00:36:44 -0800 |
commit | 71eb22a5bf94f5fa0a3c95212450e3c6a1a6a990 (patch) | |
tree | 56307b5145be44b2239d3c782234309ed714f1b6 /058stream-equal.subx | |
parent | 1a65c3af0f797892f5981f8ebd33c275c1ef06b0 (diff) | |
download | mu-71eb22a5bf94f5fa0a3c95212450e3c6a1a6a990.tar.gz |
5924
Diffstat (limited to '058stream-equal.subx')
-rw-r--r-- | 058stream-equal.subx | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/058stream-equal.subx b/058stream-equal.subx index e2009ef4..3bd6a3b3 100644 --- a/058stream-equal.subx +++ b/058stream-equal.subx @@ -6,7 +6,7 @@ # . 1-3 bytes 3 bits 2 bits 3 bits 3 bits 3 bits 2 bits 2 bits 0/1/2/4 bytes 0/1/2/4 bytes # compare all the data in a stream (ignoring the read pointer) -stream-data-equal?: # f : (addr stream byte), s : (addr array byte) -> eax : boolean +stream-data-equal?: # f: (addr stream byte), s: (addr array byte) -> eax: boolean # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -19,9 +19,9 @@ stream-data-equal?: # f : (addr stream byte), s : (addr array byte) -> eax : bo 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 . # copy *(ebp+8) to esi # eax = f->write 8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . . # copy *esi to eax - # var maxf/edx : (addr byte) = &f->data[f->write] + # var maxf/edx: (addr byte) = &f->data[f->write] 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 0/index/eax . 2/r32/edx 0xc/disp8 . # copy esi+eax+12 to edx - # var currf/esi : (addr byte) = f->data + # var currf/esi: (addr byte) = f->data 81 0/subop/add 3/mod/direct 6/rm32/esi . . . . . 0xc/imm32 # add to esi # edi = s 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 7/r32/edi 0xc/disp8 . # copy *(ebp+12) to edi @@ -29,11 +29,11 @@ $stream-data-equal?:compare-lengths: # if (f->write != s->length) return false 39/compare 0/mod/indirect 7/rm32/edi . . . 0/r32/eax . . # compare *edi and eax 75/jump-if-!= $stream-data-equal?:false/disp8 - # var currs/edi : (addr byte) = s->data + # var currs/edi: (addr byte) = s->data 81 0/subop/add 3/mod/direct 7/rm32/edi . . . . . 4/imm32 # add to edi - # var eax : byte = 0 + # var eax: byte = 0 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax - # var ecx : byte = 0 + # var ecx: byte = 0 31/xor 3/mod/direct 1/rm32/ecx . . . 1/r32/ecx . . # clear ecx $stream-data-equal?:loop: # if (currf >= maxf) return true @@ -191,7 +191,7 @@ test-stream-data-equal-length-check: c3/return # helper for later tests -check-stream-equal: # f : (addr stream byte), s : (addr array byte), msg : (addr array byte) +check-stream-equal: # f: (addr stream byte), s: (addr array byte), msg: (addr array byte) # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -227,10 +227,10 @@ $check-stream-equal:end: # on success, set f->read to after the next newline # on failure, leave f->read unmodified # this function is usually used only in tests, so we repeatedly write f->read -next-stream-line-equal?: # f : (addr stream byte), s : (addr array byte) -> eax : boolean +next-stream-line-equal?: # f: (addr stream byte), s: (addr array byte) -> eax: boolean # pseudocode: # currf = f->read # bound: f->write - # currs = 0 # bound : s->length + # currs = 0 # bound: s->length # while true # if currf >= f->write # return currs >= s->length @@ -244,7 +244,7 @@ next-stream-line-equal?: # f : (addr stream byte), s : (addr array byte) -> eax # # collapsing the two branches that can return true: # currf = f->read # bound: f->write - # currs = 0 # bound : s->length + # currs = 0 # bound: s->length # while true # if (currf >= f->write) break # if (f[currf] == '\n') break @@ -274,15 +274,15 @@ next-stream-line-equal?: # f : (addr stream byte), s : (addr array byte) -> eax 57/push-edi # esi = f 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 . # copy *(ebp+8) to esi - # var currf/ecx : int = f->read + # var currf/ecx: int = f->read 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 1/r32/ecx 4/disp8 . # copy *(esi+4) to ecx # edi = s 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 7/r32/edi 0xc/disp8 . # copy *(ebp+12) to edi - # var currs/edx : int = 0 + # var currs/edx: int = 0 31/xor 3/mod/direct 2/rm32/edx . . . 2/r32/edx . . # clear edx - # var c1/eax : byte = 0 + # var c1/eax: byte = 0 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax - # var c2/ebx : byte = 0 + # var c2/ebx: byte = 0 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . . # clear ebx $next-stream-line-equal?:loop: # if (currf >= f->write) break |