<HTML>
<div><style> BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; }</style>I've also discovered that my binary search algorithm is unfortunately slower than what already exists. Jump trees are faster if they're used.</div><div><br>
</div><div>Gareth<br>
</div> <br>
<br>
<span style="font-weight: bold;">On Fri 28/12/18 17:45 , Florian Klämpfl florian@freepascal.org sent:<br>
</span><blockquote style="BORDER-LEFT: #F5F5F5 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">Am 11.12.2018 um 20:48 schrieb Marco van de Voort:
<br>
<span style="color: rgb(102, 102, 102);">>
</span><br>
<span style="color: rgb(102, 102, 102);">> Op 2018-12-11 om 17:12 schreef J. Gareth Moreton:
</span><br>
<span style="color: rgb(102, 102, 102);">>>
</span><br>
<span style="color: rgb(102, 102, 102);">>> I've just written up a new segment on the Wiki about how jump tables work. Since I want to look at implementing my
</span><br>
<span style="color: rgb(102, 102, 102);">>> binary search option, I thought I'd document what already exists;
</span><br>
<span style="color: rgb(102, 102, 102);">>>
</span><br>
<span style="color: rgb(102, 102, 102);">>> <a target="_blank" href="<a href="http://wiki.freepascal.org/Case_Compiler_Optimization">http://wiki.freepascal.org/Case_Compiler_Optimization</a>"><span style="color: red;">http://wiki.freepascal.org/Case_Compiler_Optimization</span></a>
</span><br>
<span style="color: rgb(102, 102, 102);">>>
</span><br>
<span style="color: rgb(102, 102, 102);">>> The "Jump Table" section is what I've added. Can people check to see that I've got it correct? I had to go back and
</span><br>
<span style="color: rgb(102, 102, 102);">>> edit it a few times because I got the AT&T and Intel operand ordering mixed up!
</span><br>
<span style="color: rgb(102, 102, 102);">>
</span><br>
<span style="color: rgb(102, 102, 102);">> I'm not really a compiler person, but afaik for large n, the number of tests can be log(n) using a bisection algorithm.
</span><br>
<span style="color: rgb(102, 102, 102);">> The microchip C (pic16/18/24/33) compilre implements this. IOW the number of linear tests is not the metric to compare to.
</span><br>
<span style="color: rgb(102, 102, 102);">>
</span><br>
<br>
FPC does this if needed.
<br>
_______________________________________________
<br>
fpc-devel maillist - <a href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>
<br>
<a target="_blank" href="<a href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a>"><span style="color: red;">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</span></a>
<br>
<br>
<br>
</blockquote></HTML>