Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
count_leading_zeros.test.cpp
Go to the documentation of this file.
1
#include "
count_leading_zeros.hpp
"
2
#include <gtest/gtest.h>
3
4
using namespace
bb
;
5
6
TEST
(bitop, ClzUint3231)
7
{
8
uint32_t
a
= 0b00000000000000000000000000000001;
9
EXPECT_EQ(
numeric::count_leading_zeros
(
a
), 31U);
10
}
11
12
TEST
(bitop, ClzUint320)
13
{
14
uint32_t
a
= 0b10000000000000000000000000000001;
15
EXPECT_EQ(
numeric::count_leading_zeros
(
a
), 0U);
16
}
17
18
TEST
(bitop, ClzUint640)
19
{
20
uint64_t
a
= 0b1000000000000000000000000000000100000000000000000000000000000000;
21
EXPECT_EQ(
numeric::count_leading_zeros
(
a
), 0U);
22
}
23
24
TEST
(bitop, ClzUint256255)
25
{
26
uint256_t
a
= 0x1;
27
auto
r =
numeric::count_leading_zeros
(
a
);
28
EXPECT_EQ(r, 255U);
29
}
30
31
TEST
(bitop, ClzUint256248)
32
{
33
uint256_t
a
= 0x80;
34
auto
r =
numeric::count_leading_zeros
(
a
);
35
EXPECT_EQ(r, 248U);
36
}
bb::numeric::uint256_t
Definition
uint256.hpp:32
a
FF a
Definition
field_gt.test.cpp:51
count_leading_zeros.hpp
bb::numeric::count_leading_zeros
constexpr size_t count_leading_zeros(T const &u)
bb
Entry point for Barretenberg command-line interface.
Definition
acir_format_getters.cpp:6
bb::TEST
TEST(MegaCircuitBuilder, CopyConstructor)
Definition
mega_circuit_builder.test.cpp:14
src
barretenberg
numeric
bitop
count_leading_zeros.test.cpp
Generated by
1.9.8