10#ifndef SkTSearch_DEFINED
11#define SkTSearch_DEFINED
40template <
typename T,
typename K,
typename LESS>
54 int mid = lo + ((hi - lo) >> 1);
55 const T* elem = (
const T*)((
const char*)
base + mid * elemSize);
63 const T* elem = (
const T*)((
const char*)
base + hi * elemSize);
64 if (less(*elem,
key)) {
67 }
else if (less(
key, *elem)) {
74template <
typename T,
bool (LESS)(const T&, const T&)>
77 [](
const T&
a,
const T&
b) {
return LESS(
a,
b); });
88template <
typename T,
bool (LESS)(const T&, const T&)>
91 [](
const T* t,
const T* k) {
return LESS(*t, *k); });
95 size_t target_len,
size_t elemSize);
103 size_t target_len,
size_t elemSize);
117 const char*
lc()
const {
return fLC; }
118 size_t length()
const {
return fLength; }
126 char fStorage[STORAGE+1];
130#define SkCastForQSort(compare) reinterpret_cast<int (*)(const void*, const void*)>(compare)
int SkStrLCSearch(const char *const *base, int count, const char target[], size_t target_len, size_t elemSize)
int SkStrSearch(const char *const *base, int count, const char target[], size_t target_len, size_t elemSize)
int SkTSearch(const T base[], int count, const K &key, size_t elemSize, const LESS &less)
SkAutoAsciiToLC(const char str[], size_t len=(size_t) -1)