Skip to content

Remove field::one, field::zero, field::neg_one from Barretenberg #1270

@zac-williamson

Description

@zac-williamson

The methods field::one(), field::zero(), field::neg_one() are very old holders from when our field class was written in more of a C-style.

The original goal was to compute (at compile time) the Montgomery representation of 0, 1, -1 and access them via the above methods. This was, in the past, faster than constructing out of an integer.

The field class can implicitly construct from an int type. This constructor is also constexpr which means that the Montgomery reduction should be performed at compile-time when the input parameter is a literal.

(e.g. field foo = 1; should compile to the same code as field foo = field::one())

summary: these 3 methods serve no purpose vs constructing from int literals and add complexity + clutter. We should remove.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions