Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
general.hpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: Planned, auditors: [], commit: }
3// external_1: { status: not started, auditors: [], commit: }
4// external_2: { status: not started, auditors: [], commit: }
5// =====================
6
7#pragma once
8
10#include <type_traits>
11namespace bb::numeric {
12
23template <typename T> constexpr T ceil_div(const T& numerator, const T& denominator)
24{
25 if (denominator <= 0) {
26 bb::assert_failure("Denominator must be greater than zero.");
27 }
28
29 static_assert(std::is_integral_v<T>, "Type must be an integral type.");
30 return (numerator + denominator - 1) / denominator;
31}
32
33} // namespace bb::numeric
constexpr T ceil_div(const T &numerator, const T &denominator)
Computes the ceiling of the division of two integral types.
Definition general.hpp:23
void assert_failure(std::string const &err)
Definition assert.cpp:11
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13