diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-05-14 16:04:45 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-05-14 16:04:45 -0700 |
commit | 65361948ca7975553757a0e0df4ac7352413044c (patch) | |
tree | 22063c089f67cb0d82623f2edc2c16b7e4389d41 /html/024compare.cc.html | |
parent | 64586540eccbc0880341782d329b419ab9d002de (diff) | |
download | mu-65361948ca7975553757a0e0df4ac7352413044c.tar.gz |
1376 - update github docs
Diffstat (limited to 'html/024compare.cc.html')
-rw-r--r-- | html/024compare.cc.html | 260 |
1 files changed, 163 insertions, 97 deletions
diff --git a/html/024compare.cc.html b/html/024compare.cc.html index bb633384..56449547 100644 --- a/html/024compare.cc.html +++ b/html/024compare.cc.html @@ -2,7 +2,7 @@ <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> -<title>Mu - 024compare.cc</title> +<title>~/Desktop/s/mu/024compare.cc</title> <meta name="Generator" content="Vim/7.4"> <meta name="plugin-version" content="vim7.4_v1"> <meta name="syntax" content="cpp"> @@ -38,260 +38,326 @@ EQUAL<span class="Delimiter">,</span> Recipe_number[<span class="Constant">"equal"</span>] = EQUAL<span class="Delimiter">;</span> <span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> case EQUAL: <span class="Delimiter">{</span> - trace<span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"ingredient 0 is "</span> << current_instruction<span class="Delimiter">().</span>ingredients[<span class="Constant">0</span>]<span class="Delimiter">.</span>name<span class="Delimiter">;</span> - vector<long long int> arg0 = read_memory<span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>ingredients[<span class="Constant">0</span>]<span class="Delimiter">);</span> - trace<span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"ingredient 1 is "</span> << current_instruction<span class="Delimiter">().</span>ingredients[<span class="Constant">1</span>]<span class="Delimiter">.</span>name<span class="Delimiter">;</span> - vector<long long int> arg1 = read_memory<span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>ingredients[<span class="Constant">1</span>]<span class="Delimiter">);</span> - vector<long long int> result<span class="Delimiter">;</span> - result<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>equal<span class="Delimiter">(</span>arg0<span class="Delimiter">.</span>begin<span class="Delimiter">(),</span> arg0<span class="Delimiter">.</span>end<span class="Delimiter">(),</span> arg1<span class="Delimiter">.</span>begin<span class="Delimiter">()));</span> - trace<span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"product 0 is "</span> << result[<span class="Constant">0</span>]<span class="Delimiter">;</span> - write_memory<span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>products[<span class="Constant">0</span>]<span class="Delimiter">,</span> result<span class="Delimiter">);</span> + vector<double>& exemplar = ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">);</span> + bool result = <span class="Constant">true</span><span class="Delimiter">;</span> + for <span class="Delimiter">(</span>index_t i = <span class="Constant">1</span><span class="Delimiter">;</span> i < ingredients<span class="Delimiter">.</span>size<span class="Delimiter">();</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> + if <span class="Delimiter">(</span>!equal<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>begin<span class="Delimiter">(),</span> ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>end<span class="Delimiter">(),</span> exemplar<span class="Delimiter">.</span>begin<span class="Delimiter">()))</span> <span class="Delimiter">{</span> + result = <span class="Constant">false</span><span class="Delimiter">;</span> + <span class="Identifier">break</span><span class="Delimiter">;</span> + <span class="Delimiter">}</span> + <span class="Delimiter">}</span> + products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> + products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>result<span class="Delimiter">);</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> <span class="Delimiter">:(scenario equal)</span> recipe main [ - <span class="Constant">1</span>:integer<span class="Special"> <- </span>copy <span class="Constant">34</span>:literal - <span class="Constant">2</span>:integer<span class="Special"> <- </span>copy <span class="Constant">33</span>:literal - <span class="Constant">3</span>:integer<span class="Special"> <- </span>equal <span class="Constant">1</span>:integer<span class="Delimiter">,</span> <span class="Constant">2</span>:integer + <span class="Constant">1</span>:number<span class="Special"> <- </span>copy <span class="Constant">34</span>:literal + <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">33</span>:literal + <span class="Constant">3</span>:number<span class="Special"> <- </span>equal <span class="Constant">1</span>:number<span class="Delimiter">,</span> <span class="Constant">2</span>:number ] <span class="traceContains">+run: instruction main/2</span> <span class="traceContains">+run: ingredient 0 is 1</span> <span class="traceContains">+mem: location 1 is 34</span> <span class="traceContains">+run: ingredient 1 is 2</span> <span class="traceContains">+mem: location 2 is 33</span> -<span class="traceContains">+run: product 0 is 0</span> +<span class="traceContains">+run: product 0 is 3</span> <span class="traceContains">+mem: storing 0 in location 3</span> <span class="Delimiter">:(scenario equal2)</span> recipe main [ - <span class="Constant">1</span>:integer<span class="Special"> <- </span>copy <span class="Constant">34</span>:literal - <span class="Constant">2</span>:integer<span class="Special"> <- </span>copy <span class="Constant">34</span>:literal - <span class="Constant">3</span>:integer<span class="Special"> <- </span>equal <span class="Constant">1</span>:integer<span class="Delimiter">,</span> <span class="Constant">2</span>:integer + <span class="Constant">1</span>:number<span class="Special"> <- </span>copy <span class="Constant">34</span>:literal + <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">34</span>:literal + <span class="Constant">3</span>:number<span class="Special"> <- </span>equal <span class="Constant">1</span>:number<span class="Delimiter">,</span> <span class="Constant">2</span>:number ] <span class="traceContains">+run: instruction main/2</span> <span class="traceContains">+run: ingredient 0 is 1</span> <span class="traceContains">+mem: location 1 is 34</span> <span class="traceContains">+run: ingredient 1 is 2</span> <span class="traceContains">+mem: location 2 is 34</span> -<span class="traceContains">+run: product 0 is 1</span> +<span class="traceContains">+run: product 0 is 3</span> <span class="traceContains">+mem: storing 1 in location 3</span> +<span class="Delimiter">:(scenario equal_multiple)</span> +recipe main [ + <span class="Constant">1</span>:number<span class="Special"> <- </span>equal <span class="Constant">34</span>:literal<span class="Delimiter">,</span> <span class="Constant">34</span>:literal<span class="Delimiter">,</span> <span class="Constant">34</span>:literal +] +<span class="traceContains">+mem: storing 1 in location 1</span> + +<span class="Delimiter">:(scenario equal_multiple2)</span> +recipe main [ + <span class="Constant">1</span>:number<span class="Special"> <- </span>equal <span class="Constant">34</span>:literal<span class="Delimiter">,</span> <span class="Constant">34</span>:literal<span class="Delimiter">,</span> <span class="Constant">35</span>:literal +] +<span class="traceContains">+mem: storing 0 in location 1</span> + <span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> GREATER_THAN<span class="Delimiter">,</span> <span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> Recipe_number[<span class="Constant">"greater-than"</span>] = GREATER_THAN<span class="Delimiter">;</span> <span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> case GREATER_THAN: <span class="Delimiter">{</span> - trace<span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"ingredient 0 is "</span> << current_instruction<span class="Delimiter">().</span>ingredients[<span class="Constant">0</span>]<span class="Delimiter">.</span>name<span class="Delimiter">;</span> - vector<long long int> arg0 = read_memory<span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>ingredients[<span class="Constant">0</span>]<span class="Delimiter">);</span> - assert<span class="Delimiter">(</span>arg0<span class="Delimiter">.</span>size<span class="Delimiter">()</span> == <span class="Constant">1</span><span class="Delimiter">);</span> - trace<span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"ingredient 1 is "</span> << current_instruction<span class="Delimiter">().</span>ingredients[<span class="Constant">1</span>]<span class="Delimiter">.</span>name<span class="Delimiter">;</span> - vector<long long int> arg1 = read_memory<span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>ingredients[<span class="Constant">1</span>]<span class="Delimiter">);</span> - assert<span class="Delimiter">(</span>arg1<span class="Delimiter">.</span>size<span class="Delimiter">()</span> == <span class="Constant">1</span><span class="Delimiter">);</span> - vector<long long int> result<span class="Delimiter">;</span> - result<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>arg0[<span class="Constant">0</span>] > arg1[<span class="Constant">0</span>]<span class="Delimiter">);</span> - trace<span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"product 0 is "</span> << result[<span class="Constant">0</span>]<span class="Delimiter">;</span> - write_memory<span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>products[<span class="Constant">0</span>]<span class="Delimiter">,</span> result<span class="Delimiter">);</span> + bool result = <span class="Constant">true</span><span class="Delimiter">;</span> + for <span class="Delimiter">(</span>index_t i = <span class="Constant">0</span><span class="Delimiter">;</span> i < ingredients<span class="Delimiter">.</span>size<span class="Delimiter">();</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> + assert<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>size<span class="Delimiter">()</span> == <span class="Constant">1</span><span class="Delimiter">);</span> <span class="Comment">// scalar</span> + <span class="Delimiter">}</span> + for <span class="Delimiter">(</span>index_t i = <span class="Comment">/**/</span><span class="Constant">1</span><span class="Delimiter">;</span> i < ingredients<span class="Delimiter">.</span>size<span class="Delimiter">();</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> + if <span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i-<span class="Constant">1</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> <= ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> + result = <span class="Constant">false</span><span class="Delimiter">;</span> + <span class="Delimiter">}</span> + <span class="Delimiter">}</span> + products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> + products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>result<span class="Delimiter">);</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> <span class="Delimiter">:(scenario greater_than)</span> recipe main [ - <span class="Constant">1</span>:integer<span class="Special"> <- </span>copy <span class="Constant">34</span>:literal - <span class="Constant">2</span>:integer<span class="Special"> <- </span>copy <span class="Constant">33</span>:literal - <span class="Constant">3</span>:integer<span class="Special"> <- </span>greater-than <span class="Constant">1</span>:integer<span class="Delimiter">,</span> <span class="Constant">2</span>:integer + <span class="Constant">1</span>:number<span class="Special"> <- </span>copy <span class="Constant">34</span>:literal + <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">33</span>:literal + <span class="Constant">3</span>:boolean<span class="Special"> <- </span>greater-than <span class="Constant">1</span>:number<span class="Delimiter">,</span> <span class="Constant">2</span>:number ] <span class="traceContains">+run: instruction main/2</span> <span class="traceContains">+run: ingredient 0 is 1</span> <span class="traceContains">+mem: location 1 is 34</span> <span class="traceContains">+run: ingredient 1 is 2</span> <span class="traceContains">+mem: location 2 is 33</span> -<span class="traceContains">+run: product 0 is 1</span> +<span class="traceContains">+run: product 0 is 3</span> <span class="traceContains">+mem: storing 1 in location 3</span> <span class="Delimiter">:(scenario greater_than2)</span> recipe main [ - <span class="Constant">1</span>:integer<span class="Special"> <- </span>copy <span class="Constant">34</span>:literal - <span class="Constant">2</span>:integer<span class="Special"> <- </span>copy <span class="Constant">34</span>:literal - <span class="Constant">3</span>:integer<span class="Special"> <- </span>greater-than <span class="Constant">1</span>:integer<span class="Delimiter">,</span> <span class="Constant">2</span>:integer + <span class="Constant">1</span>:number<span class="Special"> <- </span>copy <span class="Constant">34</span>:literal + <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">34</span>:literal + <span class="Constant">3</span>:boolean<span class="Special"> <- </span>greater-than <span class="Constant">1</span>:number<span class="Delimiter">,</span> <span class="Constant">2</span>:number ] <span class="traceContains">+run: instruction main/2</span> <span class="traceContains">+run: ingredient 0 is 1</span> <span class="traceContains">+mem: location 1 is 34</span> <span class="traceContains">+run: ingredient 1 is 2</span> <span class="traceContains">+mem: location 2 is 34</span> -<span class="traceContains">+run: product 0 is 0</span> +<span class="traceContains">+run: product 0 is 3</span> <span class="traceContains">+mem: storing 0 in location 3</span> +<span class="Delimiter">:(scenario greater_than_multiple)</span> +recipe main [ + <span class="Constant">1</span>:boolean<span class="Special"> <- </span>greater-than <span class="Constant">36</span>:literal<span class="Delimiter">,</span> <span class="Constant">35</span>:literal<span class="Delimiter">,</span> <span class="Constant">34</span>:literal +] +<span class="traceContains">+mem: storing 1 in location 1</span> + +<span class="Delimiter">:(scenario greater_than_multiple2)</span> +recipe main [ + <span class="Constant">1</span>:boolean<span class="Special"> <- </span>greater-than <span class="Constant">36</span>:literal<span class="Delimiter">,</span> <span class="Constant">35</span>:literal<span class="Delimiter">,</span> <span class="Constant">35</span>:literal +] +<span class="traceContains">+mem: storing 0 in location 1</span> + <span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> LESSER_THAN<span class="Delimiter">,</span> <span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> Recipe_number[<span class="Constant">"lesser-than"</span>] = LESSER_THAN<span class="Delimiter">;</span> <span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> case LESSER_THAN: <span class="Delimiter">{</span> - trace<span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"ingredient 0 is "</span> << current_instruction<span class="Delimiter">().</span>ingredients[<span class="Constant">0</span>]<span class="Delimiter">.</span>name<span class="Delimiter">;</span> - vector<long long int> arg0 = read_memory<span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>ingredients[<span class="Constant">0</span>]<span class="Delimiter">);</span> - assert<span class="Delimiter">(</span>arg0<span class="Delimiter">.</span>size<span class="Delimiter">()</span> == <span class="Constant">1</span><span class="Delimiter">);</span> - trace<span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"ingredient 1 is "</span> << current_instruction<span class="Delimiter">().</span>ingredients[<span class="Constant">1</span>]<span class="Delimiter">.</span>name<span class="Delimiter">;</span> - vector<long long int> arg1 = read_memory<span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>ingredients[<span class="Constant">1</span>]<span class="Delimiter">);</span> - assert<span class="Delimiter">(</span>arg1<span class="Delimiter">.</span>size<span class="Delimiter">()</span> == <span class="Constant">1</span><span class="Delimiter">);</span> - vector<long long int> result<span class="Delimiter">;</span> - result<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>arg0[<span class="Constant">0</span>] < arg1[<span class="Constant">0</span>]<span class="Delimiter">);</span> - trace<span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"product 0 is "</span> << result[<span class="Constant">0</span>]<span class="Delimiter">;</span> - write_memory<span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>products[<span class="Constant">0</span>]<span class="Delimiter">,</span> result<span class="Delimiter">);</span> + bool result = <span class="Constant">true</span><span class="Delimiter">;</span> + for <span class="Delimiter">(</span>index_t i = <span class="Constant">0</span><span class="Delimiter">;</span> i < ingredients<span class="Delimiter">.</span>size<span class="Delimiter">();</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> + assert<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>size<span class="Delimiter">()</span> == <span class="Constant">1</span><span class="Delimiter">);</span> <span class="Comment">// scalar</span> + <span class="Delimiter">}</span> + for <span class="Delimiter">(</span>index_t i = <span class="Comment">/**/</span><span class="Constant">1</span><span class="Delimiter">;</span> i < ingredients<span class="Delimiter">.</span>size<span class="Delimiter">();</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> + if <span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i-<span class="Constant">1</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> >= ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> + result = <span class="Constant">false</span><span class="Delimiter">;</span> + <span class="Delimiter">}</span> + <span class="Delimiter">}</span> + products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> + products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>result<span class="Delimiter">);</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> <span class="Delimiter">:(scenario lesser_than)</span> recipe main [ - <span class="Constant">1</span>:integer<span class="Special"> <- </span>copy <span class="Constant">32</span>:literal - <span class="Constant">2</span>:integer<span class="Special"> <- </span>copy <span class="Constant">33</span>:literal - <span class="Constant">3</span>:integer<span class="Special"> <- </span>lesser-than <span class="Constant">1</span>:integer<span class="Delimiter">,</span> <span class="Constant">2</span>:integer + <span class="Constant">1</span>:number<span class="Special"> <- </span>copy <span class="Constant">32</span>:literal + <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">33</span>:literal + <span class="Constant">3</span>:boolean<span class="Special"> <- </span>lesser-than <span class="Constant">1</span>:number<span class="Delimiter">,</span> <span class="Constant">2</span>:number ] <span class="traceContains">+run: instruction main/2</span> <span class="traceContains">+run: ingredient 0 is 1</span> <span class="traceContains">+mem: location 1 is 32</span> <span class="traceContains">+run: ingredient 1 is 2</span> <span class="traceContains">+mem: location 2 is 33</span> -<span class="traceContains">+run: product 0 is 1</span> +<span class="traceContains">+run: product 0 is 3</span> <span class="traceContains">+mem: storing 1 in location 3</span> <span class="Delimiter">:(scenario lesser_than2)</span> recipe main [ - <span class="Constant">1</span>:integer<span class="Special"> <- </span>copy <span class="Constant">34</span>:literal - <span class="Constant">2</span>:integer<span class="Special"> <- </span>copy <span class="Constant">33</span>:literal - <span class="Constant">3</span>:integer<span class="Special"> <- </span>lesser-than <span class="Constant">1</span>:integer<span class="Delimiter">,</span> <span class="Constant">2</span>:integer + <span class="Constant">1</span>:number<span class="Special"> <- </span>copy <span class="Constant">34</span>:literal + <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">33</span>:literal + <span class="Constant">3</span>:boolean<span class="Special"> <- </span>lesser-than <span class="Constant">1</span>:number<span class="Delimiter">,</span> <span class="Constant">2</span>:number ] <span class="traceContains">+run: instruction main/2</span> <span class="traceContains">+run: ingredient 0 is 1</span> <span class="traceContains">+mem: location 1 is 34</span> <span class="traceContains">+run: ingredient 1 is 2</span> <span class="traceContains">+mem: location 2 is 33</span> -<span class="traceContains">+run: product 0 is 0</span> +<span class="traceContains">+run: product 0 is 3</span> <span class="traceContains">+mem: storing 0 in location 3</span> +<span class="Delimiter">:(scenario lesser_than_multiple)</span> +recipe main [ + <span class="Constant">1</span>:boolean<span class="Special"> <- </span>lesser-than <span class="Constant">34</span>:literal<span class="Delimiter">,</span> <span class="Constant">35</span>:literal<span class="Delimiter">,</span> <span class="Constant">36</span>:literal +] +<span class="traceContains">+mem: storing 1 in location 1</span> + +<span class="Delimiter">:(scenario lesser_than_multiple2)</span> +recipe main [ + <span class="Constant">1</span>:boolean<span class="Special"> <- </span>lesser-than <span class="Constant">34</span>:literal<span class="Delimiter">,</span> <span class="Constant">35</span>:literal<span class="Delimiter">,</span> <span class="Constant">35</span>:literal +] +<span class="traceContains">+mem: storing 0 in location 1</span> + <span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> GREATER_OR_EQUAL<span class="Delimiter">,</span> <span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> Recipe_number[<span class="Constant">"greater-or-equal"</span>] = GREATER_OR_EQUAL<span class="Delimiter">;</span> <span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> case GREATER_OR_EQUAL: <span class="Delimiter">{</span> - trace<span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"ingredient 0 is "</span> << current_instruction<span class="Delimiter">().</span>ingredients[<span class="Constant">0</span>]<span class="Delimiter">.</span>name<span class="Delimiter">;</span> - vector<long long int> arg0 = read_memory<span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>ingredients[<span class="Constant">0</span>]<span class="Delimiter">);</span> - assert<span class="Delimiter">(</span>arg0<span class="Delimiter">.</span>size<span class="Delimiter">()</span> == <span class="Constant">1</span><span class="Delimiter">);</span> - trace<span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"ingredient 1 is "</span> << current_instruction<span class="Delimiter">().</span>ingredients[<span class="Constant">1</span>]<span class="Delimiter">.</span>name<span class="Delimiter">;</span> - vector<long long int> arg1 = read_memory<span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>ingredients[<span class="Constant">1</span>]<span class="Delimiter">);</span> - assert<span class="Delimiter">(</span>arg1<span class="Delimiter">.</span>size<span class="Delimiter">()</span> == <span class="Constant">1</span><span class="Delimiter">);</span> - vector<long long int> result<span class="Delimiter">;</span> - result<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>arg0[<span class="Constant">0</span>] >= arg1[<span class="Constant">0</span>]<span class="Delimiter">);</span> - trace<span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"product 0 is "</span> << result[<span class="Constant">0</span>]<span class="Delimiter">;</span> - write_memory<span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>products[<span class="Constant">0</span>]<span class="Delimiter">,</span> result<span class="Delimiter">);</span> + bool result = <span class="Constant">true</span><span class="Delimiter">;</span> + for <span class="Delimiter">(</span>index_t i = <span class="Constant">0</span><span class="Delimiter">;</span> i < ingredients<span class="Delimiter">.</span>size<span class="Delimiter">();</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> + assert<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>size<span class="Delimiter">()</span> == <span class="Constant">1</span><span class="Delimiter">);</span> <span class="Comment">// scalar</span> + <span class="Delimiter">}</span> + for <span class="Delimiter">(</span>index_t i = <span class="Comment">/**/</span><span class="Constant">1</span><span class="Delimiter">;</span> i < ingredients<span class="Delimiter">.</span>size<span class="Delimiter">();</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> + if <span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i-<span class="Constant">1</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> < ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> + result = <span class="Constant">false</span><span class="Delimiter">;</span> + <span class="Delimiter">}</span> + <span class="Delimiter">}</span> + products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> + products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>result<span class="Delimiter">);</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> <span class="Delimiter">:(scenario greater_or_equal)</span> recipe main [ - <span class="Constant">1</span>:integer<span class="Special"> <- </span>copy <span class="Constant">34</span>:literal - <span class="Constant">2</span>:integer<span class="Special"> <- </span>copy <span class="Constant">33</span>:literal - <span class="Constant">3</span>:integer<span class="Special"> <- </span>greater-or-equal <span class="Constant">1</span>:integer<span class="Delimiter">,</span> <span class="Constant">2</span>:integer + <span class="Constant">1</span>:number<span class="Special"> <- </span>copy <span class="Constant">34</span>:literal + <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">33</span>:literal + <span class="Constant">3</span>:boolean<span class="Special"> <- </span>greater-or-equal <span class="Constant">1</span>:number<span class="Delimiter">,</span> <span class="Constant">2</span>:number ] <span class="traceContains">+run: instruction main/2</span> <span class="traceContains">+run: ingredient 0 is 1</span> <span class="traceContains">+mem: location 1 is 34</span> <span class="traceContains">+run: ingredient 1 is 2</span> <span class="traceContains">+mem: location 2 is 33</span> -<span class="traceContains">+run: product 0 is 1</span> +<span class="traceContains">+run: product 0 is 3</span> <span class="traceContains">+mem: storing 1 in location 3</span> <span class="Delimiter">:(scenario greater_or_equal2)</span> recipe main [ - <span class="Constant">1</span>:integer<span class="Special"> <- </span>copy <span class="Constant">34</span>:literal - <span class="Constant">2</span>:integer<span class="Special"> <- </span>copy <span class="Constant">34</span>:literal - <span class="Constant">3</span>:integer<span class="Special"> <- </span>greater-or-equal <span class="Constant">1</span>:integer<span class="Delimiter">,</span> <span class="Constant">2</span>:integer + <span class="Constant">1</span>:number<span class="Special"> <- </span>copy <span class="Constant">34</span>:literal + <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">34</span>:literal + <span class="Constant">3</span>:boolean<span class="Special"> <- </span>greater-or-equal <span class="Constant">1</span>:number<span class="Delimiter">,</span> <span class="Constant">2</span>:number ] <span class="traceContains">+run: instruction main/2</span> <span class="traceContains">+run: ingredient 0 is 1</span> <span class="traceContains">+mem: location 1 is 34</span> <span class="traceContains">+run: ingredient 1 is 2</span> <span class="traceContains">+mem: location 2 is 34</span> -<span class="traceContains">+run: product 0 is 1</span> +<span class="traceContains">+run: product 0 is 3</span> <span class="traceContains">+mem: storing 1 in location 3</span> <span class="Delimiter">:(scenario greater_or_equal3)</span> recipe main [ - <span class="Constant">1</span>:integer<span class="Special"> <- </span>copy <span class="Constant">34</span>:literal - <span class="Constant">2</span>:integer<span class="Special"> <- </span>copy <span class="Constant">35</span>:literal - <span class="Constant">3</span>:integer<span class="Special"> <- </span>greater-or-equal <span class="Constant">1</span>:integer<span class="Delimiter">,</span> <span class="Constant">2</span>:integer + <span class="Constant">1</span>:number<span class="Special"> <- </span>copy <span class="Constant">34</span>:literal + <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">35</span>:literal + <span class="Constant">3</span>:boolean<span class="Special"> <- </span>greater-or-equal <span class="Constant">1</span>:number<span class="Delimiter">,</span> <span class="Constant">2</span>:number ] <span class="traceContains">+run: instruction main/2</span> <span class="traceContains">+run: ingredient 0 is 1</span> <span class="traceContains">+mem: location 1 is 34</span> <span class="traceContains">+run: ingredient 1 is 2</span> <span class="traceContains">+mem: location 2 is 35</span> -<span class="traceContains">+run: product 0 is 0</span> +<span class="traceContains">+run: product 0 is 3</span> <span class="traceContains">+mem: storing 0 in location 3</span> +<span class="Delimiter">:(scenario greater_or_equal_multiple)</span> +recipe main [ + <span class="Constant">1</span>:boolean<span class="Special"> <- </span>greater-or-equal <span class="Constant">36</span>:literal<span class="Delimiter">,</span> <span class="Constant">35</span>:literal<span class="Delimiter">,</span> <span class="Constant">35</span>:literal +] +<span class="traceContains">+mem: storing 1 in location 1</span> + +<span class="Delimiter">:(scenario greater_or_equal_multiple2)</span> +recipe main [ + <span class="Constant">1</span>:boolean<span class="Special"> <- </span>greater-or-equal <span class="Constant">36</span>:literal<span class="Delimiter">,</span> <span class="Constant">35</span>:literal<span class="Delimiter">,</span> <span class="Constant">36</span>:literal +] +<span class="traceContains">+mem: storing 0 in location 1</span> + <span class="Delimiter">:(before "End Primitive Recipe Declarations")</span> LESSER_OR_EQUAL<span class="Delimiter">,</span> <span class="Delimiter">:(before "End Primitive Recipe Numbers")</span> Recipe_number[<span class="Constant">"lesser-or-equal"</span>] = LESSER_OR_EQUAL<span class="Delimiter">;</span> <span class="Delimiter">:(before "End Primitive Recipe Implementations")</span> case LESSER_OR_EQUAL: <span class="Delimiter">{</span> - trace<span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"ingredient 0 is "</span> << current_instruction<span class="Delimiter">().</span>ingredients[<span class="Constant">0</span>]<span class="Delimiter">.</span>name<span class="Delimiter">;</span> - vector<long long int> arg0 = read_memory<span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>ingredients[<span class="Constant">0</span>]<span class="Delimiter">);</span> - assert<span class="Delimiter">(</span>arg0<span class="Delimiter">.</span>size<span class="Delimiter">()</span> == <span class="Constant">1</span><span class="Delimiter">);</span> - trace<span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"ingredient 1 is "</span> << current_instruction<span class="Delimiter">().</span>ingredients[<span class="Constant">1</span>]<span class="Delimiter">.</span>name<span class="Delimiter">;</span> - vector<long long int> arg1 = read_memory<span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>ingredients[<span class="Constant">1</span>]<span class="Delimiter">);</span> - assert<span class="Delimiter">(</span>arg1<span class="Delimiter">.</span>size<span class="Delimiter">()</span> == <span class="Constant">1</span><span class="Delimiter">);</span> - vector<long long int> result<span class="Delimiter">;</span> - result<span class="Delimiter">.</span>push_back<span class="Delimiter">(</span>arg0[<span class="Constant">0</span>] <= arg1[<span class="Constant">0</span>]<span class="Delimiter">);</span> - trace<span class="Delimiter">(</span><span class="Constant">"run"</span><span class="Delimiter">)</span> << <span class="Constant">"product 0 is "</span> << result[<span class="Constant">0</span>]<span class="Delimiter">;</span> - write_memory<span class="Delimiter">(</span>current_instruction<span class="Delimiter">().</span>products[<span class="Constant">0</span>]<span class="Delimiter">,</span> result<span class="Delimiter">);</span> + bool result = <span class="Constant">true</span><span class="Delimiter">;</span> + for <span class="Delimiter">(</span>index_t i = <span class="Constant">0</span><span class="Delimiter">;</span> i < ingredients<span class="Delimiter">.</span>size<span class="Delimiter">();</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> + assert<span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>size<span class="Delimiter">()</span> == <span class="Constant">1</span><span class="Delimiter">);</span> <span class="Comment">// scalar</span> + <span class="Delimiter">}</span> + for <span class="Delimiter">(</span>index_t i = <span class="Comment">/**/</span><span class="Constant">1</span><span class="Delimiter">;</span> i < ingredients<span class="Delimiter">.</span>size<span class="Delimiter">();</span> ++i<span class="Delimiter">)</span> <span class="Delimiter">{</span> + if <span class="Delimiter">(</span>ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i-<span class="Constant">1</span><span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">)</span> > ingredients<span class="Delimiter">.</span>at<span class="Delimiter">(</span>i<span class="Delimiter">).</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">))</span> <span class="Delimiter">{</span> + result = <span class="Constant">false</span><span class="Delimiter">;</span> + <span class="Delimiter">}</span> + <span class="Delimiter">}</span> + products<span class="Delimiter">.</span>resize<span class="Delimiter">(</span><span class="Constant">1</span><span class="Delimiter">);</span> + products<span class="Delimiter">.</span>at<span class="Delimiter">(</span><span class="Constant">0</span><span class="Delimiter">).</span>push_back<span class="Delimiter">(</span>result<span class="Delimiter">);</span> <span class="Identifier">break</span><span class="Delimiter">;</span> <span class="Delimiter">}</span> <span class="Delimiter">:(scenario lesser_or_equal)</span> recipe main [ - <span class="Constant">1</span>:integer<span class="Special"> <- </span>copy <span class="Constant">32</span>:literal - <span class="Constant">2</span>:integer<span class="Special"> <- </span>copy <span class="Constant">33</span>:literal - <span class="Constant">3</span>:integer<span class="Special"> <- </span>lesser-or-equal <span class="Constant">1</span>:integer<span class="Delimiter">,</span> <span class="Constant">2</span>:integer + <span class="Constant">1</span>:number<span class="Special"> <- </span>copy <span class="Constant">32</span>:literal + <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">33</span>:literal + <span class="Constant">3</span>:boolean<span class="Special"> <- </span>lesser-or-equal <span class="Constant">1</span>:number<span class="Delimiter">,</span> <span class="Constant">2</span>:number ] <span class="traceContains">+run: instruction main/2</span> <span class="traceContains">+run: ingredient 0 is 1</span> <span class="traceContains">+mem: location 1 is 32</span> <span class="traceContains">+run: ingredient 1 is 2</span> <span class="traceContains">+mem: location 2 is 33</span> -<span class="traceContains">+run: product 0 is 1</span> +<span class="traceContains">+run: product 0 is 3</span> <span class="traceContains">+mem: storing 1 in location 3</span> <span class="Delimiter">:(scenario lesser_or_equal2)</span> recipe main [ - <span class="Constant">1</span>:integer<span class="Special"> <- </span>copy <span class="Constant">33</span>:literal - <span class="Constant">2</span>:integer<span class="Special"> <- </span>copy <span class="Constant">33</span>:literal - <span class="Constant">3</span>:integer<span class="Special"> <- </span>lesser-or-equal <span class="Constant">1</span>:integer<span class="Delimiter">,</span> <span class="Constant">2</span>:integer + <span class="Constant">1</span>:number<span class="Special"> <- </span>copy <span class="Constant">33</span>:literal + <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">33</span>:literal + <span class="Constant">3</span>:boolean<span class="Special"> <- </span>lesser-or-equal <span class="Constant">1</span>:number<span class="Delimiter">,</span> <span class="Constant">2</span>:number ] <span class="traceContains">+run: instruction main/2</span> <span class="traceContains">+run: ingredient 0 is 1</span> <span class="traceContains">+mem: location 1 is 33</span> <span class="traceContains">+run: ingredient 1 is 2</span> <span class="traceContains">+mem: location 2 is 33</span> -<span class="traceContains">+run: product 0 is 1</span> +<span class="traceContains">+run: product 0 is 3</span> <span class="traceContains">+mem: storing 1 in location 3</span> <span class="Delimiter">:(scenario lesser_or_equal3)</span> recipe main [ - <span class="Constant">1</span>:integer<span class="Special"> <- </span>copy <span class="Constant">34</span>:literal - <span class="Constant">2</span>:integer<span class="Special"> <- </span>copy <span class="Constant">33</span>:literal - <span class="Constant">3</span>:integer<span class="Special"> <- </span>lesser-or-equal <span class="Constant">1</span>:integer<span class="Delimiter">,</span> <span class="Constant">2</span>:integer + <span class="Constant">1</span>:number<span class="Special"> <- </span>copy <span class="Constant">34</span>:literal + <span class="Constant">2</span>:number<span class="Special"> <- </span>copy <span class="Constant">33</span>:literal + <span class="Constant">3</span>:boolean<span class="Special"> <- </span>lesser-or-equal <span class="Constant">1</span>:number<span class="Delimiter">,</span> <span class="Constant">2</span>:number ] <span class="traceContains">+run: instruction main/2</span> <span class="traceContains">+run: ingredient 0 is 1</span> <span class="traceContains">+mem: location 1 is 34</span> <span class="traceContains">+run: ingredient 1 is 2</span> <span class="traceContains">+mem: location 2 is 33</span> -<span class="traceContains">+run: product 0 is 0</span> +<span class="traceContains">+run: product 0 is 3</span> <span class="traceContains">+mem: storing 0 in location 3</span> + +<span class="Delimiter">:(scenario lesser_or_equal_multiple)</span> +recipe main [ + <span class="Constant">1</span>:boolean<span class="Special"> <- </span>lesser-or-equal <span class="Constant">34</span>:literal<span class="Delimiter">,</span> <span class="Constant">35</span>:literal<span class="Delimiter">,</span> <span class="Constant">35</span>:literal +] +<span class="traceContains">+mem: storing 1 in location 1</span> + +<span class="Delimiter">:(scenario lesser_or_equal_multiple2)</span> +recipe main [ + <span class="Constant">1</span>:boolean<span class="Special"> <- </span>lesser-or-equal <span class="Constant">34</span>:literal<span class="Delimiter">,</span> <span class="Constant">35</span>:literal<span class="Delimiter">,</span> <span class="Constant">34</span>:literal +] +<span class="traceContains">+mem: storing 0 in location 1</span> </pre> </body> </html> |