summaryrefslogtreecommitdiff
path: root/obt
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2010-04-16 11:46:52 -0400
committerMikael Magnusson <mikachu@gmail.com>2010-04-16 20:56:27 +0200
commit3997d7aef53216c15efa8757b67b1c40b6938313 (patch)
treef5f882e239313e9166aa3a928931c5cbd411bc53 /obt
parent3afa20de54814b1abb447542d72c3b795892932d (diff)
add some comments for binary search
Diffstat (limited to 'obt')
-rw-r--r--obt/bsearch.h6
1 files changed, 6 insertions, 0 deletions
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)