8 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
11 #include "../Exceptions/exceptions.h"
14 int binary_search(
int* poffset,
int target,
int* sorted_integers,
int num_integers){
29 end=sorted_integers+num_integers;
30 mid=beg+(int)(num_integers/2);
36 else if(*(end-1)==target){
38 offset=num_integers-1;
41 while((beg <= end) && (*mid != target)){
45 mid = beg + (end-beg)/2;
49 mid = beg + (end-beg)/2;
56 offset=mid-sorted_integers;