FiloSottile / edwards25519

filippo.io/edwards25519 — A safer, faster, and more powerful low-level edwards25519 Go implementation.
https://filippo.io/edwards25519
BSD 3-Clause "New" or "Revised" License
139 stars 30 forks source link

edwards25519: outline (*Point).Bytes #6

Closed lukechampine closed 3 years ago

lukechampine commented 3 years ago

(*fieldElement).Bytes() uses the inlining trick to punt its allocation up to the caller. (*Point).Bytes calls (*fieldElement).Bytes(), but (*Point).Bytes is itself too large to be inlined, so the caller of (*Point).Bytes incurs a heap allocation. This PR outlines (*Point).bytes, allowing the caller to (potentially) avoid the allocation.