<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/include/linux/bsearch.h, branch Colibri_T30_LinuxImageV2.1Beta2_20140206</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>lib: Add generic binary search function to the kernel.</title>
<updated>2011-05-19T07:25:27+00:00</updated>
<author>
<name>Tim Abbott</name>
<email>tabbott@ksplice.com</email>
</author>
<published>2011-04-14T18:00:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=1a94dc35bc5c166d89913dc01a49d27a3c21a455'/>
<id>1a94dc35bc5c166d89913dc01a49d27a3c21a455</id>
<content type='text'>
There a large number hand-coded binary searches in the kernel (run
"git grep search | grep binary" to find many of them).  Since in my
experience, hand-coding binary searches can be error-prone, it seems
worth cleaning this up by providing a generic binary search function.

This generic binary search implementation comes from Ksplice.  It has
the same basic API as the C library bsearch() function.  Ksplice uses
it in half a dozen places with 4 different comparison functions, and I
think our code is substantially cleaner because of this.

Signed-off-by: Tim Abbott &lt;tabbott@ksplice.com&gt;
Extra-bikeshedding-by: Alan Jenkins &lt;alan-jenkins@tuffmail.co.uk&gt;
Extra-bikeshedding-by: André Goddard Rosa &lt;andre.goddard@gmail.com&gt;
Extra-bikeshedding-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Signed-off-by: Alessio Igor Bogani &lt;abogani@kernel.org&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There a large number hand-coded binary searches in the kernel (run
"git grep search | grep binary" to find many of them).  Since in my
experience, hand-coding binary searches can be error-prone, it seems
worth cleaning this up by providing a generic binary search function.

This generic binary search implementation comes from Ksplice.  It has
the same basic API as the C library bsearch() function.  Ksplice uses
it in half a dozen places with 4 different comparison functions, and I
think our code is substantially cleaner because of this.

Signed-off-by: Tim Abbott &lt;tabbott@ksplice.com&gt;
Extra-bikeshedding-by: Alan Jenkins &lt;alan-jenkins@tuffmail.co.uk&gt;
Extra-bikeshedding-by: André Goddard Rosa &lt;andre.goddard@gmail.com&gt;
Extra-bikeshedding-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Signed-off-by: Alessio Igor Bogani &lt;abogani@kernel.org&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</pre>
</div>
</content>
</entry>
</feed>
