Skip to content

Commit

Permalink
doc: Document more thoroughly why fields don't 0-init (AztecProtocol/…
Browse files Browse the repository at this point in the history
…barretenberg#349)

* Update field.hpp

* Update field.hpp

* Update field.hpp
  • Loading branch information
ludamad authored Apr 13, 2023
1 parent d27f084 commit 2059e32
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions barretenberg/cpp/src/barretenberg/ecc/fields/field.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ namespace barretenberg {
template <class Params> struct alignas(32) field {
public:
// We don't initialize data by default since we'd lose a lot of time on pointless initializations.
// Other alternatives have been noted, such as casting to get around constructors where they matter,
// however it is felt that sanitizer tools (e.g. MSAN) can detect garbage well, whereas doing
// hacky casts where needed would require rework to critical algos like MSM, FFT, Sumcheck.
// Instead, the recommended solution is use an explicit = 0 where initialization is important.
field() noexcept {}

constexpr field(const uint256_t& input) noexcept
Expand Down

0 comments on commit 2059e32

Please sign in to comment.