Skip to content

Commit

Permalink
Getting rid of unbounded shift. It looked nice, but introduced memory…
Browse files Browse the repository at this point in the history
… access bugs. We should not shift over the size of values and hide it with this class.
  • Loading branch information
martun committed Jan 8, 2025
1 parent 495b145 commit d09d2bf
Show file tree
Hide file tree
Showing 34 changed files with 205 additions and 987 deletions.
3 changes: 1 addition & 2 deletions crypto3.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ in stdenv.mkDerivation {
# JUNIT file without explicit file name is generated after the name of the master test suite inside `CMAKE_CURRENT_SOURCE_DIR`
export BOOST_TEST_LOGGER=JUNIT:HRF
cd crypto3
# remove || true after all tests are fixed under clang-sanitizers check:
ctest --verbose --output-on-failure -R > test_errors.txt || true
ctest --verbose --output-on-failure -R > test_errors.txt
cd ..
mkdir -p ${placeholder "out"}/test-logs
find .. -type f -name '*_test.xml' -exec cp {} ${placeholder "out"}/test-logs \;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@

#include <algorithm>

#include <nil/crypto3/detail/assert.hpp>

#include <nil/crypto3/algebra/vector/vector.hpp>
#include <nil/crypto3/algebra/vector/math.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
#include <array>
#include <tuple>

#include <nil/crypto3/detail/assert.hpp>

#include <nil/crypto3/algebra/vector/utility.hpp>
#include <nil/crypto3/algebra/vector/vector.hpp>

Expand All @@ -52,8 +50,6 @@ namespace nil {
struct matrix {
static_assert(N != 0 && M != 0, "matrix must have have positive dimensions");

// CRYPTO3_DETAIL_ASSERT_ARITHMETIC(T)

using value_type = T;
using size_type = std::size_t;
static constexpr size_type column_size = N; ///< Number of rows
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#define CRYPTO3_ALGEBRA_SCALAR_MATH_HPP

#include <nil/crypto3/algebra/type_traits.hpp>
#include <nil/crypto3/detail/assert.hpp>

namespace nil {
namespace crypto3 {
Expand Down Expand Up @@ -74,7 +73,6 @@ namespace nil {
*/
template<typename T>
constexpr nil::crypto3::algebra::remove_complex_t<T> abs(T x) {
// CRYPTO3_DETAIL_ASSERT_ARITHMETIC(T);
if constexpr (algebra::is_complex_v<T>)
return sqrt(x.real() * x.real() + x.imag() * x.imag());
else
Expand Down Expand Up @@ -136,7 +134,6 @@ namespace nil {
*/
template<typename T>
constexpr T conj(T x) {
// CRYPTO3_DETAIL_ASSERT_ARITHMETIC(T);
if constexpr (algebra::is_complex_v<T>)
return {x.real(), -x.imag()};
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#define CRYPTO3_ALGEBRA_VECTOR_UTILITY_HPP

#include <nil/crypto3/algebra/vector/vector.hpp>
#include <nil/crypto3/detail/same_value.hpp>

#include <tuple>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
#ifndef CRYPTO3_ALGEBRA_VECTOR_CLASS_HPP
#define CRYPTO3_ALGEBRA_VECTOR_CLASS_HPP

#include <nil/crypto3/detail/same_value.hpp>
#include <nil/crypto3/detail/assert.hpp>

#include <array>
#include <cstddef>

Expand All @@ -49,7 +46,6 @@ namespace nil {
template<typename T, std::size_t N>
struct vector {
static_assert(N != 0, "vector must contain at least one element");
// CRYPTO3_DETAIL_ASSERT_ARITHMETIC(T)

using value_type = T;
using size_type = std::size_t;
Expand Down
55 changes: 0 additions & 55 deletions crypto3/libs/algebra/include/nil/crypto3/detail/assert.hpp

This file was deleted.

This file was deleted.

75 changes: 0 additions & 75 deletions crypto3/libs/algebra/include/nil/crypto3/detail/make_array.hpp

This file was deleted.

62 changes: 0 additions & 62 deletions crypto3/libs/algebra/include/nil/crypto3/detail/make_uint_t.hpp

This file was deleted.

37 changes: 0 additions & 37 deletions crypto3/libs/algebra/include/nil/crypto3/detail/octet.hpp

This file was deleted.

Loading

0 comments on commit d09d2bf

Please sign in to comment.