6#ifndef THEORETICA_BIT_OP_H
7#define THEORETICA_BIT_OP_H
47 (
m[2] & 0xffffffff)) >> 32;
49 c_low =
m[0] + (
m[1] << 32) + (
m[2] << 32);
76 template<
typename Un
signedIntType>
89 template<
typename Vector, enable_vector<Vector> = true>
93 TH_MATH_ERROR(
"swap_bit_reverse", x.size(), INVALID_ARGUMENT);
97 for (
unsigned int i = 0; i < x.size(); i++) {
101 for (
unsigned int k = 0;
k <
m;
k++)
102 j = (
j << 1) | ((i >>
k) & 0x01);
105 std::swap(x[i], x[
j]);
#define TH_CONSTEXPR
Enable constexpr in function declarations if C++14 is supported.
Definition constants.h:161
#define TH_MATH_ERROR(F_NAME, VALUE, EXCEPTION)
TH_MATH_ERROR is a macro which throws exceptions or modifies errno (depending on which compiling opti...
Definition error.h:219
Main namespace of the library which contains all functions and objects.
Definition algebra.h:27
std::remove_reference_t< decltype(std::declval< Structure >()[0])> vector_element_t
Extract the type of a vector (or any indexable container) from its operator[].
Definition core_traits.h:134
TH_CONSTEXPR UnsignedIntType bit_rotate(UnsignedIntType x, unsigned int i)
Bit rotation of unsigned integer types using shifts.
Definition bit_op.h:78
uint64_t mix_mum(uint64_t a, uint64_t b)
MUM bit mixing function, computes the 128-bit product of a and b and the XOR of their high and low 64...
Definition bit_op.h:62
void mul_uint128(uint64_t a, uint64_t b, uint64_t &c_low, uint64_t &c_high)
Multiply two 64-bit unsigned integers and store the result in two 64-bit variables,...
Definition bit_op.h:24
void swap_bit_reverse(Vector &x, unsigned int m)
Swap the elements of a vector pair-wise, by exchanging elements with indices related by bit reversion...
Definition bit_op.h:90