Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
keep_n_lsb.hpp
Go to the documentation of this file.
1
// === AUDIT STATUS ===
2
// internal: { status: not started, auditors: [], date: YYYY-MM-DD }
3
// external_1: { status: not started, auditors: [], date: YYYY-MM-DD }
4
// external_2: { status: not started, auditors: [], date: YYYY-MM-DD }
5
// =====================
6
7
#pragma once
8
#include <cstddef>
9
10
namespace
bb::numeric
{
11
12
template
<
typename
T>
inline
T
keep_n_lsb
(T
const
& input,
size_t
num_bits)
13
{
14
return
num_bits >=
sizeof
(T) * 8 ? input : input & ((T(1) << num_bits) - 1);
15
}
16
17
}
// namespace bb::numeric
bb::numeric
Definition
field2_declarations.hpp:12
bb::numeric::keep_n_lsb
T keep_n_lsb(T const &input, size_t num_bits)
Definition
keep_n_lsb.hpp:12
src
barretenberg
numeric
bitop
keep_n_lsb.hpp
Generated by
1.9.8