Initial import of libdpf.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
commit
e4e666f459
4563 changed files with 1690372 additions and 0 deletions
24
test/tests/helpers/domain_walk.hpp
Normal file
24
test/tests/helpers/domain_walk.hpp
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#ifndef LIBDPF_TEST_TESTS_HELPERS_DOMAIN_WALK_HPP__
|
||||
#define LIBDPF_TEST_TESTS_HELPERS_DOMAIN_WALK_HPP__
|
||||
|
||||
// eval_interval / eval_full emit points in integer order of the input bits
|
||||
// (the same order as operator++ for ordinary integers). xor_wrapper::operator++
|
||||
// is characteristic-2 addition, XOR 1, so it does not walk that domain.
|
||||
template <typename InputT>
|
||||
InputT next_domain_point(InputT cur)
|
||||
{
|
||||
if constexpr (dpf::utils::has_characteristic_two_v<InputT>)
|
||||
{
|
||||
using narrow = dpf::utils::integral_type_from_bitlength_t<dpf::utils::bitlength_of_v<InputT>>;
|
||||
auto bits = static_cast<narrow>(dpf::utils::to_integral_type<InputT>{}(cur));
|
||||
bits = static_cast<narrow>(bits + narrow{1});
|
||||
return dpf::utils::make_from_integral_value<InputT>{}(bits);
|
||||
}
|
||||
else
|
||||
{
|
||||
++cur;
|
||||
return cur;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // LIBDPF_TEST_TESTS_HELPERS_DOMAIN_WALK_HPP__
|
||||
Loading…
Add table
Add a link
Reference in a new issue