Skip to content

Commit

Permalink
Merge branch 'main' of github.com:spaceandtimelabs/blitzar into c-PRO…
Browse files Browse the repository at this point in the history
…OF-913
  • Loading branch information
rnburn committed Feb 13, 2025
2 parents 69eb5d8 + 5ef238b commit 76fe1ad
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cbindings/backend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static void try_get_environ_backend(int& backend) noexcept {
return;
}
std::string s{val};
basl::info("override default backend with environmental varaible BLITZAR_BACKEND={}", s);
basl::info("override default backend with environmental variable BLITZAR_BACKEND={}", s);
for (auto& c : s) {
c = std::tolower(c);
}
Expand Down
12 changes: 6 additions & 6 deletions sxt/multiexp/pippenger/exponent_aggregates_computation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@

namespace sxt::mtxpi {
//--------------------------------------------------------------------------------------------------
// aggegate_term
// aggregate_term
//--------------------------------------------------------------------------------------------------
static void aggegate_term(exponent_aggregates& aggregates, basct::cspan<uint8_t> term,
size_t output_index, size_t term_index) noexcept {
static void aggregate_term(exponent_aggregates& aggregates, basct::cspan<uint8_t> term,
size_t output_index, size_t term_index) noexcept {
basbt::or_equal(aggregates.term_or_all[term_index], term);
basbt::or_equal(aggregates.output_or_all[output_index], term);
basbt::max_equal(aggregates.max_exponent, term);
Expand All @@ -50,7 +50,7 @@ static void aggregate_unsigned_terms(exponent_aggregates& aggregates, size_t out
auto element_nbytes = sequence.element_nbytes;
for (size_t term_index = 0; term_index < sequence.n; ++term_index) {
basct::cspan<uint8_t> term{sequence.data + term_index * element_nbytes, element_nbytes};
aggegate_term(aggregates, term, output_index, term_index);
aggregate_term(aggregates, term, output_index, term_index);
}
}

Expand All @@ -66,9 +66,9 @@ static void aggregate_signed_terms(exponent_aggregates& aggregates, size_t outpu
auto abs_x = basn::abs_to_unsigned(x);
basct::cspan<uint8_t> term{reinterpret_cast<uint8_t*>(&abs_x), NumBytes};
if (x >= 0) {
aggegate_term(aggregates, term, output_index, term_index);
aggregate_term(aggregates, term, output_index, term_index);
} else {
aggegate_term(aggregates, term, output_index + 1, term_index);
aggregate_term(aggregates, term, output_index + 1, term_index);
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions sxt/scalar25/operation/reduce.t.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,39 +76,39 @@ TEST_CASE("we correctly reduces arrays with 64 bytes") {
element s = 0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ec_s25;
element expected_s = s;
uint8_t s_data[64] = {};
std::memcpy(s_data, s.data(), 32); // we copy the 32 bytes to the begginning of s_data
std::memcpy(s_data, s.data(), 32); // we copy the 32 bytes to the beginning of s_data
reduce64(s, s_data);
REQUIRE(s == expected_s);
}

SECTION("we correctly reduce A when A = L (L = the field order)") {
element s = 0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed_s25;
uint8_t s_data[64] = {};
std::memcpy(s_data, s.data(), 32); // we copy the 32 bytes to the begginning of s_data
std::memcpy(s_data, s.data(), 32); // we copy the 32 bytes to the beginning of s_data
reduce64(s, s_data);
REQUIRE(s == 0x0_s25);
}

SECTION("we correctly reduce A when A = L + 103 (L = the field order)") {
element s = 0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d454_s25;
uint8_t s_data[64] = {};
std::memcpy(s_data, s.data(), 32); // we copy the 32 bytes to the begginning of s_data
std::memcpy(s_data, s.data(), 32); // we copy the 32 bytes to the beginning of s_data
reduce64(s, s_data);
REQUIRE(s == 0x67_s25);
}

SECTION("we correctly reduce A when A is the biggest 256bits integer") {
element s = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff_s25;
uint8_t s_data[64] = {};
std::memcpy(s_data, s.data(), 32); // we copy the 32 bytes to the begginning of s_data
std::memcpy(s_data, s.data(), 32); // we copy the 32 bytes to the beginning of s_data
reduce64(s, s_data);
REQUIRE(s == 0xffffffffffffffffffffffffffffffec6ef5bf4737dcf70d6ec31748d98951c_s25);
}

SECTION("we correctly reduce A when A is the biggest 512bits integer") {
element s = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff_s25;
uint8_t s_data[64] = {};
std::memcpy(s_data, s.data(), 32); // we copy the 32 bytes to the begginning of s_data
std::memcpy(s_data, s.data(), 32); // we copy the 32 bytes to the beginning of s_data
std::memcpy(s_data + 32, s.data(), 32); // we copy the 32 bytes to the end of s_data
reduce64(s, s_data);
REQUIRE(s == 0x399411b7c309a3dceec73d217f5be65d00e1ba768859347a40611e3449c0f00_s25);
Expand Down

0 comments on commit 76fe1ad

Please # to comment.