lambdaworks icon indicating copy to clipboard operation
lambdaworks copied to clipboard

Add `to_bits_be` for `FieldElement<Stark252PrimeField>`

Open tcoratger opened this issue 10 months ago • 2 comments

Add to_bits_be for FieldElement<Stark252PrimeField>

Description

Following to_bits_le, an implementation of to_bits_be for FieldElement<Stark252PrimeField> is added. A unit test is also integrated to validate the correct implementation of the two methods.

Type of change

Please delete options that are not relevant.

  • [X] New feature
  • [ ] Bug fix
  • [ ] Optimization

Checklist

  • [ ] Linked to Github Issue
  • [X] Unit tests added
  • [X] This change requires new documentation.
    • [X] Documentation has been added/updated.
  • [ ] This change is an Optimization
    • [ ] Benchmarks added/run

tcoratger avatar Apr 21 '24 22:04 tcoratger

Bits operations in field elements is a bad idea. In the base type it's ok, if you want to use it you should use the raw data of the base type or call the representative. Calling the representative all the time means a heavy penalty to the operation cost, so it's not a good idea to use it

MauroToscano avatar Apr 22 '24 16:04 MauroToscano

I see now that we have the to bits_le, we should probably remove both in the future, in the meanwhile we can add it

MauroToscano avatar Apr 22 '24 17:04 MauroToscano

We will be removing the functionality of to_bits_le, so I am closing this PR

diegokingston avatar Oct 04 '24 15:10 diegokingston