mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-12 01:07:46 +00:00
Rewrites FieldP to use the new 4×64-bit limb representation: - All field operations (add, sub, mul, sqr, neg, half, inv, sqrt) now operate on LongArray(4) - reduceWide uses unsignedMultiplyHigh for the hi×C reduction step, leveraging the hardware intrinsic on JVM - Thread-local scratch is LongArray(8) instead of IntArray(16) - Addition chains for inv/sqrt unchanged (same algorithm, new types) The reduceWide is cleaner than the 8×32 version: since C = 2^32+977 < 2^33, each hi[i]×C product fits in 97 bits, and unsignedMultiplyHigh gives the upper 64 bits directly. NOTE: Build still broken — ScalarN, Glv, Point, KeyCodec, Secp256k1, and tests still expect IntArray(8). https://claude.ai/code/session_01BhU63WUe9AhikZxRdw3Lpg