25 #ifndef __ETL__MISC_H_
26 #define __ETL__MISC_H_
41 template<
typename I,
typename T>
inline I
45 I iter(begin+(end-begin)/2);
47 while(end-begin>1 && !(*iter==value))
49 ((*iter<value)?begin:end) = iter;
51 iter = begin+(end-begin)/2;
55 size_t len_(end-begin);
61 while(len_>1 && !(*iter==value))
63 ((*iter<value)?begin:end) = iter;
81 if (x>=0)
return static_cast<int>(x + 0.5);
82 else return static_cast<int>(x - 0.5);
87 if (x>=0)
return static_cast<int>(x + 0.5);
88 else return static_cast<int>(x - 0.5);
94 inline int floor_to_int(
const float x) {
return static_cast<int>(x); }
95 inline int floor_to_int(
const double x) {
return static_cast<int>(x); }