858cf2ea1a
Phase 1 optimizations from C code analysis: 1. Dedicated sqrWide: Exploits a[i]*a[j] symmetry — 36 inner products instead of 64. Reduces field squaring cost by ~40%. 2. Mixed Jacobian+Affine addition (addMixed): 8M+3S instead of 12M+4S. Saves 4 multiplications per addition when one operand is affine. Used for precomputed G table lookups during Shamir's trick. 3. Optimized point doubling (3M+4S via fe_half): Uses the (3/2)*X² formula from libsecp256k1, replacing a field multiplication with a cheap halving operation (carry-propagating right shift). 4. fe_half: Branchless divide-by-2 mod p, used by the new doubling formula. 5. AffinePoint type: Stores precomputed table entries as (x,y) without z, enabling mixed addition. G table now stored as affine. 6. U256.mulShift: 256x256→shift multiplication for future GLV scalar decomposition. 7. GLV infrastructure (straussGlvGP, scalarSplitLambda, wNAF, endomorphism constants): Implemented but not yet wired into the verify hot path due to sign-handling bugs being debugged. The 4-stream Strauss with GLV will halve doublings from 256→128 once the sign logic is fixed. Benchmark: verifySchnorr 1,940 → 2,116 ops/s (~9% improvement) The modest gain reflects that only G-side additions use mixed add; P-side still uses full Jacobian. GLV will provide the next big jump. https://claude.ai/code/session_01BhU63WUe9AhikZxRdw3Lpg