Commit 5269e41b authored by s_kleplj's avatar s_kleplj
Browse files

.

parent 6156dbd5
......@@ -57,16 +57,16 @@ struct policy_data_base<policy_avx512> {
template<typename policy>
struct policy_data {
using data_packed = typename policy_data_base<policy>::data_packed;
static constexpr std::size_t pack_size = sizeof(data_packed) / sizeof(data_element);
static inline constexpr std::size_t pack_size = sizeof(data_packed) / sizeof(data_element);
};
template<typename policy, std::size_t size>
struct get_jump {
private:
static constexpr std::size_t pack_size = policy_data<policy>::pack_size;
static inline constexpr std::size_t pack_size = policy_data<policy>::pack_size;
public:
using value_type = std::size_t;
static constexpr value_type value =
static inline constexpr value_type value =
size > pack_size * pack_size
? get_jump<policy, size / pack_size>::value * pack_size + pack_size
: size / pack_size;
......@@ -75,10 +75,10 @@ public:
template<typename policy, std::size_t size>
struct next_size {
private:
static constexpr std::size_t pack_size = policy_data<policy>::pack_size;
static inline constexpr std::size_t pack_size = policy_data<policy>::pack_size;
public:
using value_type = std::size_t;
static constexpr value_type value =
static inline constexpr value_type value =
size > pack_size
? size / pack_size
: 1;
......@@ -87,27 +87,29 @@ public:
template<typename policy>
class bsearch_inner {
using data_packed = typename policy_data<policy>::data_packed;
static constexpr std::size_t pack_size = policy_data<policy>::pack_size;
static inline constexpr std::size_t pack_size = policy_data<policy>::pack_size;
public:
bsearch_inner(const data_element* data, std::size_t size)
inline bsearch_inner(const data_element* data, std::size_t size)
: structure{}
, isize{size}
{
append_data(data, isize / pack_size, isize);
}
void append_data(const data_element* data, std::size_t step, std::size_t count)
inline void append_data(const data_element* data, std::size_t step, std::size_t count)
{
for (std::size_t i = step; i <= count; i += step) {
structure.emplace_back(data[i - 1]);
}
if (step > 1) for (std::size_t i = 0; i < count; i += step) {
append_data(data + i, step / pack_size == 0 ? 1 : step / pack_size, step);
if (step > 1) {
for (std::size_t i = 0; i < count; i += step) {
append_data(data + i, step / pack_size == 0 ? 1 : step / pack_size, step);
}
}
}
std::size_t find(data_element num) const
inline std::size_t find(data_element num) const __attribute__((always_inline)) __attribute__((flatten))
{
switch (isize)
{
......@@ -131,11 +133,11 @@ class bsearch_inner {
}
}
const std::size_t &size() const { return isize; }
inline const std::size_t &size() const { return isize; }
private:
template<std::size_t size>
static std::size_t _find(const data_element* offset, const std::size_t accumulator, const data_element num);
static inline std::size_t _find(const data_element* offset, const std::size_t accumulator, const data_element num) __attribute__((always_inline)) __attribute__((flatten));
std::vector<data_element> structure;
std::size_t isize;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment