X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fopenbox;a=blobdiff_plain;f=obt%2Fbsearch.h;h=65e426806f898fff58222d8cea30e9364cb0079e;hp=ca5ae5b27a05158b93a328cbf1473965c2aff217;hb=3997d7aef53216c15efa8757b67b1c40b6938313;hpb=3afa20de54814b1abb447542d72c3b795892932d diff --git a/obt/bsearch.h b/obt/bsearch.h index ca5ae5b2..65e42680 100644 --- a/obt/bsearch.h +++ b/obt/bsearch.h @@ -23,9 +23,12 @@ G_BEGIN_DECLS +/*! Setup to do a binary search on an array holding elements of type @t */ #define BSEARCH_SETUP(t) \ register t l_BSEARCH, r_BSEARCH, out_BSEARCH; +/*! Search an array @ar holding elements of type @t, starting at index @start, + with @size elements, looking for value @val. */ #define BSEARCH(t, ar, start, size, val) \ { \ l_BSEARCH = (start); \ @@ -44,7 +47,10 @@ G_BEGIN_DECLS } \ } +/*! Returns true if the element last searched for was found in the array */ #define BSEARCH_FOUND() (l_BSEARCH <= r_BSEARCH) +/*! Returns the position in the array at which the element last searched for + was found. */ #define BSEARCH_AT() (out_BSEARCH)