#ifndef SEEN_VEC_BSRCH_H #define SEEN_VEC_BSRCH_H #include #include #include extern type_len vec_bsrch(type_len, vec_type const*, void const*, int (*)(void const*, void const*), type_bool, type_len); #define VEC_BSRCHF(type, vec, d, compar) \ (WARN_TYPE(type*, d), \ vec_bsrch(sizeof (type), VEC_GV(type, vec), (d), (compar), 0, 0)) #define VEC_BSRCHL(type, vec, d, compar) \ (WARN_TYPE(type*, d), \ vec_bsrch(sizeof (type), VEC_GV(type, vec), (d), (compar), 1, 0)) #define VEC_BSRCHR(type, vec, d, compar, f, l) \ (WARN_TYPE(type*, d), WARN_TYPE(type_len*, f), WARN_TYPE(type_len*, l), \ *f=vec_bsrch(sizeof (type), VEC_GV(type, vec), (d), (compar), 0, 0), \ *l=vec_bsrch(sizeof (type), VEC_GV(type, vec), (d), (compar), 1, *f)+*f, \ *l-*f) #define VEC_BSRCHC(type, vec, d, compar) \ (WARN_TYPE(type*, d), \ vec_bsrch(sizeof (type), VEC_GV(type, vec), (d), (compar), 1, \ vec_bsrch(sizeof (type), VEC_GV(type, vec), (d), (compar), 0, 0))) #endif