blst icon indicating copy to clipboard operation
blst copied to clipboard

feat(bindings/rust): add constructor for affine points

Open jacobkaufmann opened this issue 10 months ago • 4 comments

in the rust bindings, add a constructor for affine points (i.e. p1_affines and p2_affines) whose argument is a slice of affine points.

jacobkaufmann avatar Mar 25 '24 21:03 jacobkaufmann

The trouble is that the data will be duplicated, which is likely undesirable. Because customarily you'd work with a larger number of points. One would rather want to borrow it. In other words the question is if it's possible to arrange it so that it's borrowed, or rather cow-ed...

dot-asm avatar May 14 '24 22:05 dot-asm

I agree that it would be better to avoid the allocation, but I would rather not alter the internal representation of the affine points to keep the change simple. the From performs an allocation, and that is the only way to construct e.g. p1_affines, so I assumed that the allocation would not be a blocker.

jacobkaufmann avatar May 15 '24 11:05 jacobkaufmann

the From performs an allocation

It has to because it goes into a type with distinctly different memory layout, and it's computationally intensive in comparison to allocation, so it's justified. Affine to affine would be a pure waste. As for internal representation, it's not public, so it's not impossible to change it...

dot-asm avatar May 15 '24 21:05 dot-asm

Have a look at #219.

dot-asm avatar May 27 '24 08:05 dot-asm

#219 is merged.

dot-asm avatar May 30 '24 14:05 dot-asm