Skip to content

perf: non-native ToBitsCanonical inline binary decomposition and range checking #1225

@ivokub

Description

@ivokub

Currently in the PR #1224 for obtaining canonical bit representation of the non-native element we first reduce the element, assert that it is in range and then call the non-native ToBits method. However, in this case we do essentially binary decomposition twice:

  1. when asserting that non-native element is in range in AssertIsInRange method
  2. when doing binary decomposition of the limbs in ToBits method

Secondly, it would be good if we have also an option to provide ToBits and ToBitsCanonical the number of bits we are interested in. This for example allows to avoid AssertIsInRange in case where we require only a few bits (as in native ToBits)

  • It would be better to merge the two operations for better efficiency.
  • Add option for requesting less bits

Metadata

Metadata

Assignees

Labels

consolidatestrengthen an existing feature

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions