60 const Tkey *__restrict__ key,
63 const Tkey &value_min,
64 const Tkey &value_max,
69 SHAM_ASSERT((first < last) ? key[first] <= value_min :
true);
70 SHAM_ASSERT((first < last) ? key[last - 1] >= value_max :
true);
81 if (inf > first && inf < last) {
82 inf -= (key[inf] > value_min);
84 if (sup > first && sup <= last) {
85 sup -= (key[sup - 1] == value_max);
std::uint32_t u32
32 bit unsigned integer
Shamrock assertion utility.
#define SHAM_ASSERT(x)
Shorthand for SHAM_ASSERT_NAMED without a message.
GPU compatible implementation of std::lower_bound.
namespace for primitive algorithm (e.g. sort, scan, reductions, ...)
constexpr u32 binary_search_upper_bound(const Tkey *__restrict__ key, u32 first, u32 last, const Tkey &value)
GPU compatible implementation of std::upper_bound.
constexpr void binary_range_search(const Tkey *__restrict__ key, u32 first, u32 last, const Tkey &value_min, const Tkey &value_max, u32 &inf, u32 &sup)
Find the range of indices for which key[inf] <= value_min <= value_max <= key[sup].
constexpr u32 binary_search_lower_bound(const Tkey *__restrict__ key, u32 first, u32 last, const Tkey &value)
GPU compatible implementation of std::lower_bound.
GPU compatible implementation of std::upper_bound.