From: Tim Abbott Date: Thu, 14 Apr 2011 18:00:19 +0000 (+0200) Subject: lib: Add generic binary search function to the kernel. X-Git-Tag: v3.0-rc1~419^2~6 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1a94dc35bc5c166d89913dc01a49d27a3c21a455;p=pandora-kernel.git lib: Add generic binary search function to the kernel. 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 Extra-bikeshedding-by: Alan Jenkins Extra-bikeshedding-by: André Goddard Rosa Extra-bikeshedding-by: Rusty Russell Signed-off-by: Rusty Russell Signed-off-by: Alessio Igor Bogani Signed-off-by: Rusty Russell --- Reading git-diff-tree failed