diff options
author | Kartik Agaram <vc@akkartik.com> | 2019-02-05 23:30:12 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2019-02-05 23:30:12 -0800 |
commit | 6e181e7fd998a0d542cb531c929c905a243ea2f6 (patch) | |
tree | 8ddf150f1a48da93e28c60ebe2dde9bf2264421d /html/subx/054string-equal.subx.html | |
parent | f070557859fd1e8396d8bdbdc3ba6162c1d7e118 (diff) | |
download | mu-6e181e7fd998a0d542cb531c929c905a243ea2f6.tar.gz |
4953
Diffstat (limited to 'html/subx/054string-equal.subx.html')
-rw-r--r-- | html/subx/054string-equal.subx.html | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/html/subx/054string-equal.subx.html b/html/subx/054string-equal.subx.html index 2544aca2..be10a769 100644 --- a/html/subx/054string-equal.subx.html +++ b/html/subx/054string-equal.subx.html @@ -74,7 +74,7 @@ if ('onhashchange' in window) { <span id="L13" class="LineNr"> 13 </span> b8/copy-to-EAX 1/imm32/exit <span id="L14" class="LineNr"> 14 </span> cd/syscall 0x80/imm8 <span id="L15" class="LineNr"> 15 </span> -<span id="L16" class="LineNr"> 16 </span><span class="subxFunction">string-equal</span>: <span class="subxComment"># s : string, benchmark : string -> EAX : boolean</span> +<span id="L16" class="LineNr"> 16 </span><span class="subxFunction">string-equal?</span>: <span class="subxComment"># s : string, benchmark : string -> EAX : boolean</span> <span id="L17" class="LineNr"> 17 </span> <span class="subxComment"># pseudocode:</span> <span id="L18" class="LineNr"> 18 </span> <span class="subxComment"># if s->length != b->length return false</span> <span id="L19" class="LineNr"> 19 </span> <span class="subxComment"># for i = 0; i < s->length; ++i</span> @@ -104,38 +104,38 @@ if ('onhashchange' in window) { <span id="L43" class="LineNr"> 43 </span> 8b/copy 0/mod/indirect 0/rm32/EAX <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/EDX <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *EAX to EDX</span> <span id="L44" class="LineNr"> 44 </span> <span class="subxComment"># compare s->length and b->length</span> <span id="L45" class="LineNr"> 45 </span> 39/compare 0/mod/indirect 3/rm32/EBX <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/EDX <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># compare *EBX with EDX</span> -<span id="L46" class="LineNr"> 46 </span> 75/jump-if-not-equal $string-equal:false/disp8 -<span id="L47" class="LineNr"> 47 </span><span class="Constant">$string-equal:lengths</span>: +<span id="L46" class="LineNr"> 46 </span> 75/jump-if-not-equal $string-equal?:false/disp8 +<span id="L47" class="LineNr"> 47 </span><span class="Constant">$string-equal?:lengths</span>: <span id="L48" class="LineNr"> 48 </span> <span class="subxComment"># var i/ECX : int = 0</span> <span id="L49" class="LineNr"> 49 </span> b9/copy-to-ECX 0/imm32 <span id="L50" class="LineNr"> 50 </span> <span class="subxComment"># EBX = &b[i]</span> <span id="L51" class="LineNr"> 51 </span> 43/inc-EBX <span id="L52" class="LineNr"> 52 </span> <span class="subxComment"># EAX = &s[i]</span> <span id="L53" class="LineNr"> 53 </span> 40/inc-EAX -<span id="L54" class="LineNr"> 54 </span><span class="Constant">$string-equal:loop</span>: +<span id="L54" class="LineNr"> 54 </span><span class="Constant">$string-equal?:loop</span>: <span id="L55" class="LineNr"> 55 </span> <span class="subxComment"># if i >= s->length return true</span> <span id="L56" class="LineNr"> 56 </span> 39/compare 3/mod/direct 1/rm32/ECX <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 2/r32/EDX <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># compare ECX with EDX</span> -<span id="L57" class="LineNr"> 57 </span> 7d/jump-if-greater-or-equal $string-equal:true/disp8 +<span id="L57" class="LineNr"> 57 </span> 7d/jump-if-greater-or-equal $string-equal?:true/disp8 <span id="L58" class="LineNr"> 58 </span> <span class="subxComment"># if b[i] != s[i] return false</span> <span id="L59" class="LineNr"> 59 </span> <span class="subxComment"># ESI = s[i]</span> <span id="L60" class="LineNr"> 60 </span> 8b/copy 0/mod/indirect 0/rm32/EAX <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/ESI <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy *EAX to ESI</span> <span id="L61" class="LineNr"> 61 </span> <span class="subxComment"># compare b[i] with ESI</span> <span id="L62" class="LineNr"> 62 </span> 39/compare 0/mod/indirect 3/rm32/EBX <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/ESI <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># compare *EBX with ESI</span> -<span id="L63" class="LineNr"> 63 </span> 75/jump-if-not-equal $string-equal:false/disp8 +<span id="L63" class="LineNr"> 63 </span> 75/jump-if-not-equal $string-equal?:false/disp8 <span id="L64" class="LineNr"> 64 </span> <span class="subxComment"># ++i</span> <span id="L65" class="LineNr"> 65 </span> 41/inc-ECX <span id="L66" class="LineNr"> 66 </span> 40/inc-EAX <span id="L67" class="LineNr"> 67 </span> 43/inc-EBX <span id="L68" class="LineNr"> 68 </span> <span class="subxComment"># loop</span> -<span id="L69" class="LineNr"> 69 </span> eb/jump $string-equal:loop/disp8 -<span id="L70" class="LineNr"> 70 </span><span class="Constant">$string-equal:true</span>: +<span id="L69" class="LineNr"> 69 </span> eb/jump $string-equal?:loop/disp8 +<span id="L70" class="LineNr"> 70 </span><span class="Constant">$string-equal?:true</span>: <span id="L71" class="LineNr"> 71 </span> <span class="subxComment"># return true</span> <span id="L72" class="LineNr"> 72 </span> b8/copy-to-EAX 1/imm32 -<span id="L73" class="LineNr"> 73 </span> eb/jump $string-equal:end/disp8 -<span id="L74" class="LineNr"> 74 </span><span class="Constant">$string-equal:false</span>: +<span id="L73" class="LineNr"> 73 </span> eb/jump $string-equal?:end/disp8 +<span id="L74" class="LineNr"> 74 </span><span class="Constant">$string-equal?:false</span>: <span id="L75" class="LineNr"> 75 </span> <span class="subxComment"># return false</span> <span id="L76" class="LineNr"> 76 </span> b8/copy-to-EAX 0/imm32 -<span id="L77" class="LineNr"> 77 </span><span class="Constant">$string-equal:end</span>: +<span id="L77" class="LineNr"> 77 </span><span class="Constant">$string-equal?:end</span>: <span id="L78" class="LineNr"> 78 </span> <span class="subxS1Comment"># . restore registers</span> <span id="L79" class="LineNr"> 79 </span> 5e/pop-to-ESI <span id="L80" class="LineNr"> 80 </span> 5b/pop-to-EBX @@ -149,12 +149,12 @@ if ('onhashchange' in window) { <span id="L88" class="LineNr"> 88 </span><span class="subxH1Comment"># - tests</span> <span id="L89" class="LineNr"> 89 </span> <span id="L90" class="LineNr"> 90 </span><span class="subxTest">test-compare-empty-with-empty-string</span>: -<span id="L91" class="LineNr"> 91 </span> <span class="subxComment"># EAX = string-equal("", "")</span> +<span id="L91" class="LineNr"> 91 </span> <span class="subxComment"># EAX = string-equal?("", "")</span> <span id="L92" class="LineNr"> 92 </span> <span class="subxS2Comment"># . . push args</span> <span id="L93" class="LineNr"> 93 </span> 68/push <span class="Constant">""</span>/imm32 <span id="L94" class="LineNr"> 94 </span> 68/push <span class="Constant">""</span>/imm32 <span id="L95" class="LineNr"> 95 </span> <span class="subxS2Comment"># . . call</span> -<span id="L96" class="LineNr"> 96 </span> e8/call <a href='054string-equal.subx.html#L16'>string-equal</a>/disp32 +<span id="L96" class="LineNr"> 96 </span> e8/call <a href='054string-equal.subx.html#L16'>string-equal?</a>/disp32 <span id="L97" class="LineNr"> 97 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L98" class="LineNr"> 98 </span> 81 0/subop/add 3/mod/direct 4/rm32/ESP <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 8/imm32 <span class="subxComment"># add to ESP</span> <span id="L99" class="LineNr"> 99 </span> <span class="subxComment"># check-ints-equal(EAX, 1, msg)</span> @@ -169,12 +169,12 @@ if ('onhashchange' in window) { <span id="L108" class="LineNr">108 </span> c3/return <span id="L109" class="LineNr">109 </span> <span id="L110" class="LineNr">110 </span><span class="subxTest">test-compare-empty-with-non-empty-string</span>: <span class="subxComment"># also checks length-mismatch code path</span> -<span id="L111" class="LineNr">111 </span> <span class="subxComment"># EAX = string-equal("", "Abc")</span> +<span id="L111" class="LineNr">111 </span> <span class="subxComment"># EAX = string-equal?("", "Abc")</span> <span id="L112" class="LineNr">112 </span> <span class="subxS2Comment"># . . push args</span> <span id="L113" class="LineNr">113 </span> 68/push <span class="Constant">"Abc"</span>/imm32 <span id="L114" class="LineNr">114 </span> 68/push <span class="Constant">""</span>/imm32 <span id="L115" class="LineNr">115 </span> <span class="subxS2Comment"># . . call</span> -<span id="L116" class="LineNr">116 </span> e8/call <a href='054string-equal.subx.html#L16'>string-equal</a>/disp32 +<span id="L116" class="LineNr">116 </span> e8/call <a href='054string-equal.subx.html#L16'>string-equal?</a>/disp32 <span id="L117" class="LineNr">117 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L118" class="LineNr">118 </span> 81 0/subop/add 3/mod/direct 4/rm32/ESP <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 8/imm32 <span class="subxComment"># add to ESP</span> <span id="L119" class="LineNr">119 </span> <span class="subxComment"># check-ints-equal(EAX, 0, msg)</span> @@ -189,12 +189,12 @@ if ('onhashchange' in window) { <span id="L128" class="LineNr">128 </span> c3/return <span id="L129" class="LineNr">129 </span> <span id="L130" class="LineNr">130 </span><span class="subxTest">test-compare-equal-strings</span>: -<span id="L131" class="LineNr">131 </span> <span class="subxComment"># EAX = string-equal("Abc", "Abc")</span> +<span id="L131" class="LineNr">131 </span> <span class="subxComment"># EAX = string-equal?("Abc", "Abc")</span> <span id="L132" class="LineNr">132 </span> <span class="subxS2Comment"># . . push args</span> <span id="L133" class="LineNr">133 </span> 68/push <span class="Constant">"Abc"</span>/imm32 <span id="L134" class="LineNr">134 </span> 68/push <span class="Constant">"Abc"</span>/imm32 <span id="L135" class="LineNr">135 </span> <span class="subxS2Comment"># . . call</span> -<span id="L136" class="LineNr">136 </span> e8/call <a href='054string-equal.subx.html#L16'>string-equal</a>/disp32 +<span id="L136" class="LineNr">136 </span> e8/call <a href='054string-equal.subx.html#L16'>string-equal?</a>/disp32 <span id="L137" class="LineNr">137 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L138" class="LineNr">138 </span> 81 0/subop/add 3/mod/direct 4/rm32/ESP <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 8/imm32 <span class="subxComment"># add to ESP</span> <span id="L139" class="LineNr">139 </span> <span class="subxComment"># check-ints-equal(EAX, 1, msg)</span> @@ -209,12 +209,12 @@ if ('onhashchange' in window) { <span id="L148" class="LineNr">148 </span> c3/return <span id="L149" class="LineNr">149 </span> <span id="L150" class="LineNr">150 </span><span class="subxTest">test-compare-inequal-strings-equal-lengths</span>: -<span id="L151" class="LineNr">151 </span> <span class="subxComment"># EAX = string-equal("Abc", "Adc")</span> +<span id="L151" class="LineNr">151 </span> <span class="subxComment"># EAX = string-equal?("Abc", "Adc")</span> <span id="L152" class="LineNr">152 </span> <span class="subxS2Comment"># . . push args</span> <span id="L153" class="LineNr">153 </span> 68/push <span class="Constant">"Adc"</span>/imm32 <span id="L154" class="LineNr">154 </span> 68/push <span class="Constant">"Abc"</span>/imm32 <span id="L155" class="LineNr">155 </span> <span class="subxS2Comment"># . . call</span> -<span id="L156" class="LineNr">156 </span> e8/call <a href='054string-equal.subx.html#L16'>string-equal</a>/disp32 +<span id="L156" class="LineNr">156 </span> e8/call <a href='054string-equal.subx.html#L16'>string-equal?</a>/disp32 <span id="L157" class="LineNr">157 </span> <span class="subxS2Comment"># . . discard args</span> <span id="L158" class="LineNr">158 </span> 81 0/subop/add 3/mod/direct 4/rm32/ESP <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 8/imm32 <span class="subxComment"># add to ESP</span> <span id="L159" class="LineNr">159 </span> <span class="subxComment"># check-ints-equal(EAX, 0, msg)</span> |