utils: spell "barrett" correctly

As P. T. Barnoom famously said, "write what you like but spell my name
correctly". Following that, we correct the spelling of Barrett's name
in the source tree.

Closes #11989
This commit is contained in:
Avi Kivity
2022-11-16 07:54:16 +02:00
committed by Botond Dénes
parent 2f2f01b045
commit 3497891cf9
4 changed files with 25 additions and 25 deletions

View File

@@ -11,7 +11,7 @@
#include <boost/test/unit_test.hpp>
#include "utils/crc.hh"
#include "utils/clmul.hh"
#include "utils/gz/barett.hh"
#include "utils/gz/barrett.hh"
#include <seastar/core/print.hh>
constexpr uint32_t input_32_1_c = 0x12345678;
@@ -29,8 +29,8 @@ BOOST_AUTO_TEST_CASE(clmul_u32_constexpr_equals_native) {
}
BOOST_AUTO_TEST_CASE(barrett_fold_constexpr_equals_native) {
constexpr auto constexpr_result = crc32_fold_barett_u64(input_64_1_c);
BOOST_REQUIRE_EQUAL(crc32_fold_barett_u64(input_64_1), constexpr_result);
constexpr auto constexpr_result = crc32_fold_barrett_u64(input_64_1_c);
BOOST_REQUIRE_EQUAL(crc32_fold_barrett_u64(input_64_1), constexpr_result);
}
inline
uint32_t

View File

@@ -35,14 +35,14 @@ inline
constexpr uint64_t barrett_reduction_constants[2] = { 0x00000001F7011641, 0x00000001DB710641 };
/*
* Calculates representation of p(x) mod G(x) using Barett reduction.
* Calculates representation of p(x) mod G(x) using Barrett reduction.
*
* p(x) is a polynomial of degree 64.
*
* The parameter p is a bit-reversed representation of the polynomial,
* the least significant bit corresponds to the coefficient of x^63.
*/
inline constexpr uint32_t crc32_fold_barett_u64_constexpr(uint64_t p) {
inline constexpr uint32_t crc32_fold_barrett_u64_constexpr(uint64_t p) {
auto x0 = p;
auto x1 = x0;
uint64_t mask32 = 0xffff'ffff;
@@ -56,7 +56,7 @@ inline constexpr uint32_t crc32_fold_barett_u64_constexpr(uint64_t p) {
#include <wmmintrin.h>
inline
uint32_t crc32_fold_barett_u64_in_m128(__m128i x0) {
uint32_t crc32_fold_barrett_u64_in_m128(__m128i x0) {
__m128i x1;
const __m128i mask32 = (__m128i)(__v4si){ int32_t(0xFFFFFFFF) };
const __v2di brc =
@@ -112,8 +112,8 @@ uint32_t crc32_fold_barett_u64_in_m128(__m128i x0) {
}
inline
uint32_t crc32_fold_barett_u64_native(uint64_t p) {
return crc32_fold_barett_u64_in_m128(_mm_set_epi64x(0, p));
uint32_t crc32_fold_barrett_u64_native(uint64_t p) {
return crc32_fold_barrett_u64_in_m128(_mm_set_epi64x(0, p));
}
#elif defined(__aarch64__)
@@ -121,7 +121,7 @@ uint32_t crc32_fold_barett_u64_native(uint64_t p) {
#include <arm_neon.h>
inline
uint32_t crc32_fold_barett_u64_in_u64x2(uint64x2_t x0) {
uint32_t crc32_fold_barrett_u64_in_u64x2(uint64x2_t x0) {
uint64x2_t x1;
const uint64_t barrett_reduction_constant_lo = barrett_reduction_constants[0];
const uint64_t barrett_reduction_constant_hi = barrett_reduction_constants[1];
@@ -137,8 +137,8 @@ uint32_t crc32_fold_barett_u64_in_u64x2(uint64x2_t x0) {
}
inline
uint32_t crc32_fold_barett_u64_native(uint64_t p) {
return crc32_fold_barett_u64_in_u64x2(
uint32_t crc32_fold_brarett_u64_native(uint64_t p) {
return crc32_fold_barrett_u64_in_u64x2(
vcombine_u64((uint64x1_t)p, (uint64x1_t)0UL));
}
@@ -150,6 +150,6 @@ uint32_t crc32_fold_barett_u64_native(uint64_t p) {
inline
constexpr
uint32_t crc32_fold_barett_u64(uint64_t p) {
return std::is_constant_evaluated() ? crc32_fold_barett_u64_constexpr(p) : crc32_fold_barett_u64_native(p);
uint32_t crc32_fold_barrett_u64(uint64_t p) {
return std::is_constant_evaluated() ? crc32_fold_barrett_u64_constexpr(p) : crc32_fold_barrett_u64_native(p);
}

View File

@@ -44,7 +44,7 @@ using u64 = uint64_t;
#if defined(__x86_64__) || defined(__i386__) || defined(__aarch64__)
#include "barett.hh"
#include "barrett.hh"
/*
* Calculates:
@@ -66,7 +66,7 @@ u64 pmul(u32 p1, u32 p2) {
*/
static
u32 pmul_mod(u32 p1, u32 p2) {
return crc32_fold_barett_u64(pmul(p1, p2));
return crc32_fold_barrett_u64(pmul(p1, p2));
}
/*
@@ -145,8 +145,8 @@ u32 mul_by_x_pow_mul8(u32 p, u64 e) {
u64 y0 = pmul(p, x0);
u64 y1 = pmul(x1, x2);
u32 z0 = crc32_fold_barett_u64(y0);
u32 z1 = crc32_fold_barett_u64(y1);
u32 z0 = crc32_fold_barrett_u64(y0);
u32 z1 = crc32_fold_barrett_u64(y1);
if (__builtin_expect(e < 0x1000000, true)) {
return pmul_mod(z0, z1);
@@ -168,12 +168,12 @@ u32 mul_by_x_pow_mul8(u32 p, u64 e) {
u64 y3 = pmul(x6, x7);
u64 u0 = pmul(z0, z1);
u32 z2 = crc32_fold_barett_u64(y2);
u32 z3 = crc32_fold_barett_u64(y3);
u32 z2 = crc32_fold_barrett_u64(y2);
u32 z3 = crc32_fold_barrett_u64(y3);
u64 u1 = pmul(z2, z3);
u32 v0 = crc32_fold_barett_u64(u0);
u32 v1 = crc32_fold_barett_u64(u1);
u32 v0 = crc32_fold_barrett_u64(u0);
u32 v1 = crc32_fold_barrett_u64(u1);
return pmul_mod(v0, v1);
}
@@ -208,7 +208,7 @@ u32 fast_crc32_combine(u32 crc, u32 crc2, ssize_t len2) {
#else
// FIXME: Optimize for other archs
// That boils down to implementing crc32_fold_barett_u64() and clmul()
// That boils down to implementing crc32_fold_barrett_u64() and clmul()
// and reusing the algorithm above. For now, delegate to zlib.
#include <zlib.h>

View File

@@ -13,7 +13,7 @@
#include "crc_combine_table.hh"
#include "utils/clmul.hh"
#include "barett.hh"
#include "barrett.hh"
template <int bits>
static
@@ -26,7 +26,7 @@ make_crc32_power_table() {
// x^(2*N) mod G(x)
// = (x^N)*(x^N) mod G(x)
// = (x^N mod G(x))^2 mod G(x)
pows[i] = crc32_fold_barett_u64(clmul(pows[i - 1], pows[i - 1]) << 1);
pows[i] = crc32_fold_barrett_u64(clmul(pows[i - 1], pows[i - 1]) << 1);
}
return pows;
}
@@ -40,7 +40,7 @@ make_crc32_table(int base, int radix_bits, uint32_t one, std::array<uint32_t, 32
uint32_t product = one;
for (int j = 0; j < radix_bits; ++j) {
if (i & (1 << j)) {
product = crc32_fold_barett_u64(clmul(product, pows[base + j]) << 1);
product = crc32_fold_barrett_u64(clmul(product, pows[base + j]) << 1);
}
}
table[i] = product;