Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
4255eb8
[linalg] Rename internal header concepts.hpp to exposition.hpp
tobiashienzsch Sep 7, 2025
70addb4
[linalg] Start BLAS3 matrix product
tobiashienzsch Sep 7, 2025
90da1b2
[linalg] Rename common_size_type_t to common_index_type_t
tobiashienzsch Sep 8, 2025
02f72b8
[linalg] Naming cleanup
tobiashienzsch Sep 8, 2025
9146f3f
[linalg] Use common index_type for loop counters
tobiashienzsch Sep 8, 2025
ce610a4
[cmath] Use more gcc & clang builtins
tobiashienzsch Sep 8, 2025
b3cf576
[linalg] Add BLAS1 dot
tobiashienzsch Sep 8, 2025
fc54c06
[mpl] Add doxygen group tags
tobiashienzsch Sep 8, 2025
cdf1d93
[cmath] Add doxygen group tags
tobiashienzsch Sep 8, 2025
b9b921a
[cmath] Use more builtins
tobiashienzsch Sep 9, 2025
7aea1c2
[cmath] Add tests for signbit
tobiashienzsch Sep 9, 2025
30ea6e0
[cmath] Fix constexpr signbit on clang versions 17 to 19
tobiashienzsch Sep 9, 2025
8e89b2f
Cleanup formatting
tobiashienzsch Sep 9, 2025
455c618
[format] Remove broken implementation & header
tobiashienzsch Sep 9, 2025
e4e9059
Enable all contract checks in CMake desktop presets
tobiashienzsch Sep 9, 2025
f97a428
Remove experimental/net
tobiashienzsch Sep 9, 2025
ec67393
[type_traits] Add doxygen group tags
tobiashienzsch Sep 11, 2025
ddba2d0
[cmath] Use builtin abs & fabs for floating-point
tobiashienzsch Sep 11, 2025
2187a37
[complex] Merge private headers
tobiashienzsch Sep 11, 2025
b5956a8
[complex] Fix doxygen tag
tobiashienzsch Sep 14, 2025
d2103cb
[cmath] Improve ipow
tobiashienzsch Sep 14, 2025
adb3b7f
Upgrade pre-commit hooks
tobiashienzsch Sep 14, 2025
6f983dd
[cmath] Improve type deduction in ipow
tobiashienzsch Sep 16, 2025
a8eacbb
[cstring] Use __builtin_memcpy also on gcc
tobiashienzsch Sep 16, 2025
6445b73
[bitset] Replace operator[] with unchecked_at in basic_bitset
tobiashienzsch Sep 16, 2025
1bb9067
Rename fuzz targets
tobiashienzsch Sep 16, 2025
6ba4e3c
[cstring] Use more builtins with gcc
tobiashienzsch Sep 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ repos:
types_or: [c++, c]

- repo: https://github.com/fsfe/reuse-tool
rev: v5.0.2
rev: v5.1.1
hooks:
- id: reuse
6 changes: 5 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
{
"name": "desktop",
"description": "Configure with hosted system toolchain",
"inherits": ["_root-config"]
"inherits": ["_root-config"],
"cacheVariables": {
"TETL_BUILD_CONTRACT_CHECKS": true,
"TETL_BUILD_CONTRACT_CHECKS_SAFE": true
}
},
{
"name": "avr-gcc",
Expand Down
1 change: 0 additions & 1 deletion examples/all_headers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import etl;
#include <etl/execution.hpp>
#include <etl/expected.hpp>
#include <etl/flat_set.hpp>
#include <etl/format.hpp>
#include <etl/functional.hpp>
#include <etl/inplace_vector.hpp>
#include <etl/ios.hpp>
Expand Down
20 changes: 10 additions & 10 deletions fuzzing/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ bin:

.PHONY: build
build: bin
$(CXX) $(CXXFLAGS) -I ../include -o bin/fuzz_algorithm src/fuzz_algorithm.cpp
$(CXX) $(CXXFLAGS) -I ../include -o bin/fuzz_bitset src/fuzz_bitset.cpp
$(CXX) $(CXXFLAGS) -I ../include -o bin/fuzz_from_chars src/fuzz_from_chars.cpp
$(CXX) $(CXXFLAGS) -I ../include -o bin/fuzz_string_view src/fuzz_string_view.cpp
$(CXX) $(CXXFLAGS) -I ../include -o bin/fuzz_to_chars src/fuzz_to_chars.cpp
$(CXX) $(CXXFLAGS) -I ../include -o bin/algorithm.fuzz src/algorithm.fuzz.cpp
$(CXX) $(CXXFLAGS) -I ../include -o bin/bitset.fuzz src/bitset.fuzz.cpp
$(CXX) $(CXXFLAGS) -I ../include -o bin/from_chars.fuzz src/from_chars.fuzz.cpp
$(CXX) $(CXXFLAGS) -I ../include -o bin/string_view.fuzz src/string_view.fuzz.cpp
$(CXX) $(CXXFLAGS) -I ../include -o bin/to_chars.fuzz src/to_chars.fuzz.cpp

.PHONY: fuzz
fuzz: build
$(LCOV) -c -i -d . --base-directory . -o bin/base_cov.info --ignore-errors inconsistent
LLVM_PROFILE_FILE="bin/%p-%m.profraw" ./bin/fuzz_algorithm -max_total_time=$(MAXTIME)
LLVM_PROFILE_FILE="bin/%p-%m.profraw" ./bin/fuzz_bitset -max_total_time=$(MAXTIME)
LLVM_PROFILE_FILE="bin/%p-%m.profraw" ./bin/fuzz_from_chars -max_total_time=$(MAXTIME)
LLVM_PROFILE_FILE="bin/%p-%m.profraw" ./bin/fuzz_string_view -max_total_time=$(MAXTIME)
LLVM_PROFILE_FILE="bin/%p-%m.profraw" ./bin/fuzz_to_chars -max_total_time=$(MAXTIME)
LLVM_PROFILE_FILE="bin/%p-%m.profraw" ./bin/algorithm.fuzz -max_total_time=$(MAXTIME)
LLVM_PROFILE_FILE="bin/%p-%m.profraw" ./bin/bitset.fuzz -max_total_time=$(MAXTIME)
LLVM_PROFILE_FILE="bin/%p-%m.profraw" ./bin/from_chars.fuzz -max_total_time=$(MAXTIME)
LLVM_PROFILE_FILE="bin/%p-%m.profraw" ./bin/string_view.fuzz -max_total_time=$(MAXTIME)
LLVM_PROFILE_FILE="bin/%p-%m.profraw" ./bin/to_chars.fuzz -max_total_time=$(MAXTIME)
$(LCOV) -c -d . --base-directory . -o bin/fuzz_cov.info --ignore-errors inconsistent
$(LCOV) -a bin/base_cov.info -a bin/fuzz_cov.info -o bin/cov.info --ignore-errors inconsistent
$(LCOV) --remove bin/cov.info "*clang*" -o bin/cov.info --ignore-errors inconsistent
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions include/etl/_bitset/basic_bitset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,22 +87,22 @@ struct basic_bitset {
}

/// Returns the number of bits that the bitset holds.
[[nodiscard]] constexpr auto size() const noexcept -> etl::size_t
[[nodiscard]] static constexpr auto size() noexcept -> etl::size_t
{
return Bits;
}

/// Returns true if the bit at position \p pos is set.
/// \pre `pos < size()`
[[nodiscard]] constexpr auto operator[](etl::size_t pos) const -> bool
[[nodiscard]] constexpr auto unchecked_at(etl::size_t pos) const -> bool
{
TETL_PRECONDITION(pos < size());
return unchecked_test(pos);
}

/// Returns a reference to the bit at position \p pos
/// \pre `pos < size()`
[[nodiscard]] constexpr auto operator[](etl::size_t pos) -> reference
[[nodiscard]] constexpr auto unchecked_at(etl::size_t pos) -> reference
{
TETL_PRECONDITION(pos < size());
return reference{_words[word_index(pos)], offset_in_word(pos)};
Expand Down
4 changes: 2 additions & 2 deletions include/etl/_bitset/bitset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ struct bitset {
[[nodiscard]] constexpr auto operator[](size_t const pos) -> reference
{
TETL_PRECONDITION(pos < size());
return _bits[pos];
return _bits.unchecked_at(pos);
}

/// Returns the value of the bit at the position pos. Perfoms no
Expand All @@ -170,7 +170,7 @@ struct bitset {
[[nodiscard]] constexpr auto operator[](size_t const pos) const -> bool
{
TETL_PRECONDITION(pos < size());
return _bits[pos];
return _bits.unchecked_at(pos);
}

/// Returns the value of the bit at the position pos. Perfoms no
Expand Down
2 changes: 1 addition & 1 deletion include/etl/_cmath/acos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ inline constexpr struct acos {
}
[[nodiscard]] constexpr auto acos(integral auto arg) noexcept -> double
{
return etl::detail::acos(double(arg));
return etl::detail::acos(static_cast<double>(arg));
}

/// @}
Expand Down
2 changes: 1 addition & 1 deletion include/etl/_cmath/acosh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ inline constexpr struct acosh {
}
[[nodiscard]] constexpr auto acosh(integral auto arg) noexcept -> double
{
return etl::detail::acosh(double(arg));
return etl::detail::acosh(static_cast<double>(arg));
}

/// @}
Expand Down
2 changes: 1 addition & 1 deletion include/etl/_cmath/asin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ inline constexpr struct asin {
}
[[nodiscard]] constexpr auto asin(integral auto arg) noexcept -> double
{
return etl::detail::asin(double(arg));
return etl::detail::asin(static_cast<double>(arg));
}

/// @}
Expand Down
2 changes: 1 addition & 1 deletion include/etl/_cmath/asinh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ inline constexpr struct asinh {
}
[[nodiscard]] constexpr auto asinh(integral auto arg) noexcept -> double
{
return etl::detail::asinh(double(arg));
return etl::detail::asinh(static_cast<double>(arg));
}

/// @}
Expand Down
2 changes: 1 addition & 1 deletion include/etl/_cmath/atan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ inline constexpr struct atan {
}
[[nodiscard]] constexpr auto atan(integral auto arg) noexcept -> double
{
return etl::detail::atan(double(arg));
return etl::detail::atan(static_cast<double>(arg));
}

/// @}
Expand Down
34 changes: 29 additions & 5 deletions include/etl/_cmath/atan2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,58 @@

namespace etl {

namespace detail {

inline constexpr struct atan2 {
template <typename Float>
[[nodiscard]] constexpr auto operator()(Float x, Float y) const noexcept -> Float
{
if (not is_constant_evaluated()) {
#if __has_builtin(__builtin_atan2f)
if constexpr (etl::same_as<Float, float>) {
return __builtin_atan2f(x, y);
}
#endif
#if __has_builtin(__builtin_atan2)
if constexpr (etl::same_as<Float, double>) {
return __builtin_atan2(x, y);
}
#endif
}
return etl::detail::gcem::atan2(x, y);
}
} atan2;

} // namespace detail

/// \ingroup cmath
/// @{

/// Computes the arc tangent of y/x using the signs of arguments to determine the correct quadrant.
/// \details https://en.cppreference.com/w/cpp/numeric/math/atan2
[[nodiscard]] constexpr auto atan2(float x, float y) noexcept -> float
{
return etl::detail::gcem::atan2(x, y);
return etl::detail::atan2(x, y);
}

[[nodiscard]] constexpr auto atan2f(float x, float y) noexcept -> float
{
return etl::detail::gcem::atan2(x, y);
return etl::detail::atan2(x, y);
}

[[nodiscard]] constexpr auto atan2(double x, double y) noexcept -> double
{
return etl::detail::gcem::atan2(x, y);
return etl::detail::atan2(x, y);
}

[[nodiscard]] constexpr auto atan2(long double x, long double y) noexcept -> long double
{
return etl::detail::gcem::atan2(x, y);
return etl::detail::atan2(x, y);
}

[[nodiscard]] constexpr auto atan2l(long double x, long double y) noexcept -> long double
{
return etl::detail::gcem::atan2(x, y);
return etl::detail::atan2(x, y);
}

/// @}
Expand Down
38 changes: 32 additions & 6 deletions include/etl/_cmath/atanh.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,60 @@

namespace etl {

namespace detail {

inline constexpr struct atanh {
template <typename Float>
[[nodiscard]] constexpr auto operator()(Float arg) const noexcept -> Float
{
#if not defined(__AVR__)
if (not is_constant_evaluated()) {
#if __has_builtin(__builtin_atanhf)
if constexpr (etl::same_as<Float, float>) {
return __builtin_atanhf(arg);
}
#endif
#if __has_builtin(__builtin_atanh)
if constexpr (etl::same_as<Float, double>) {
return __builtin_atanh(arg);
}
#endif
}
#endif
return etl::detail::gcem::atanh(arg);
}
} atanh;

} // namespace detail

/// \ingroup cmath
/// @{

/// Computes the inverse hyperbolic tangent of arg.
/// \details https://en.cppreference.com/w/cpp/numeric/math/atanh
[[nodiscard]] constexpr auto atanh(float arg) noexcept -> float
{
return etl::detail::gcem::atanh(arg);
return etl::detail::atanh(arg);
}
[[nodiscard]] constexpr auto atanhf(float arg) noexcept -> float
{
return etl::detail::gcem::atanh(arg);
return etl::detail::atanh(arg);
}
[[nodiscard]] constexpr auto atanh(double arg) noexcept -> double
{
return etl::detail::gcem::atanh(arg);
return etl::detail::atanh(arg);
}
[[nodiscard]] constexpr auto atanh(long double arg) noexcept -> long double
{
return etl::detail::gcem::atanh(arg);
return etl::detail::atanh(arg);
}
[[nodiscard]] constexpr auto atanhl(long double arg) noexcept -> long double
{
return etl::detail::gcem::atanh(arg);
return etl::detail::atanh(arg);
}
[[nodiscard]] constexpr auto atanh(integral auto arg) noexcept -> double
{
return etl::detail::gcem::atanh(double(arg));
return etl::detail::atanh(static_cast<double>(arg));
}

/// @}
Expand Down
36 changes: 30 additions & 6 deletions include/etl/_cmath/ceil.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,58 @@

namespace etl {

namespace detail {

inline constexpr struct ceil {
template <typename Float>
[[nodiscard]] constexpr auto operator()(Float arg) const noexcept -> Float
{
if (not is_constant_evaluated()) {
#if __has_builtin(__builtin_ceilf)
if constexpr (etl::same_as<Float, float>) {
return __builtin_ceilf(arg);
}
#endif
#if __has_builtin(__builtin_ceil)
if constexpr (etl::same_as<Float, double>) {
return __builtin_ceil(arg);
}
#endif
}
return etl::detail::gcem::ceil(arg);
}
} ceil;

} // namespace detail

/// \ingroup cmath
/// @{

/// Computes the smallest integer value not less than arg.
/// \details https://en.cppreference.com/w/cpp/numeric/math/ceil
[[nodiscard]] constexpr auto ceil(float arg) noexcept -> float
{
return etl::detail::gcem::ceil(arg);
return etl::detail::ceil(arg);
}
[[nodiscard]] constexpr auto ceilf(float arg) noexcept -> float
{
return etl::detail::gcem::ceil(arg);
return etl::detail::ceil(arg);
}
[[nodiscard]] constexpr auto ceil(double arg) noexcept -> double
{
return etl::detail::gcem::ceil(arg);
return etl::detail::ceil(arg);
}
[[nodiscard]] constexpr auto ceil(long double arg) noexcept -> long double
{
return etl::detail::gcem::ceil(arg);
return etl::detail::ceil(arg);
}
[[nodiscard]] constexpr auto ceill(long double arg) noexcept -> long double
{
return etl::detail::gcem::ceil(arg);
return etl::detail::ceil(arg);
}
[[nodiscard]] constexpr auto ceil(integral auto arg) noexcept -> double
{
return etl::detail::gcem::ceil(double(arg));
return etl::detail::ceil(static_cast<double>(arg));
}

/// @}
Expand Down
2 changes: 1 addition & 1 deletion include/etl/_cmath/cos.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ inline constexpr struct cos {
}
[[nodiscard]] constexpr auto cos(integral auto arg) noexcept -> double
{
return etl::detail::cos(double(arg));
return etl::detail::cos(static_cast<double>(arg));
}

/// @}
Expand Down
Loading