Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
memory_tag.cpp
Go to the documentation of this file.
1
2
5
7
9{
10 const MemoryTagOptions option = config.select(rng);
11 switch (option) {
13 return MemoryTag::U1;
15 return MemoryTag::U8;
17 return MemoryTag::U16;
19 return MemoryTag::U32;
21 return MemoryTag::U64;
23 return MemoryTag::U128;
25 return MemoryTag::FF;
26 }
27}
28
30{
31 const MemoryTagOptions option = config.select(rng);
32 switch (option) {
34 value = MemoryTag::U1;
35 break;
37 value = MemoryTag::U8;
38 break;
40 value = MemoryTag::U16;
41 break;
43 value = MemoryTag::U32;
44 break;
46 value = MemoryTag::U64;
47 break;
49 value = MemoryTag::U128;
50 break;
52 value = MemoryTag::FF;
53 break;
54 }
55}
56
57void mutate_or_default_tag(MemoryTag& value, std::mt19937_64& rng, MemoryTag default_tag, double probability = 0.1)
58{
59 if (std::uniform_real_distribution<double>(0.0, 1.0)(rng) < probability) {
61 } else {
62 value = default_tag;
63 }
64}
T select(std::mt19937_64 &rng) const
MemoryTagOptions
constexpr MemoryTagMutationConfig BASIC_MEMORY_TAG_MUTATION_CONFIGURATION
MemoryTag generate_memory_tag(std::mt19937_64 &rng, const MemoryTagGenerationConfig &config)
Definition memory_tag.cpp:8
void mutate_or_default_tag(MemoryTag &value, std::mt19937_64 &rng, MemoryTag default_tag, double probability=0.1)
Mutate the memory tag or set to the chosen tag with a given probability.
void mutate_memory_tag(MemoryTag &value, std::mt19937_64 &rng, const MemoryTagMutationConfig &config)
ValueTag MemoryTag
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13