Restore const modifier to Word::is_empty() once P3 supports const PartialEq
- Langage dominant
- Rust
- Étoiles
- 772
- Forks
- 352
- Merge moyen
- 1 j 12 h
- PR mergées (30 j)
- 93
Description
The `Word::is_empty()` method lost its `const` modifier during the Plonky3 migration because P3's `Felt` doesn't have a const `.inner()` method and `PartialEq` isn't const.
## Previous Implementation (const)
```rust
pub const fn is_empty(&self) -> bool {
const ZERO_FELT_INNER: u64 = Felt::ZERO.inner();
self.0[0].inner() == ZERO_FELT_INNER
&& self.0[1].inner() == ZERO_FELT_INNER
&& self.0[2].inner() == ZERO_FELT_INNER
&& self.0[3].inner() == ZERO_FELT_INNER
}
```
## Current Implementation (not const)
```rust
pub fn is_empty(&self) -> bool {
self.0[0] == Felt::ZERO
&& self.0[1] == Felt::ZERO
&& self.0[2] == Felt::ZERO
&& self.0[3] == Felt::ZERO
}
```
## Action Required
Once upstream Plonky3 adds support for const `PartialEq` and const field element operations, restore the `const` modifier to this method.
Part of 0xMiden/crypto#724
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.