mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-09 16:14:40 +00:00
Full migration of the secp256k1 library from LongArray(4)/LongArray(8) to Fe4/Wide8 struct types with @JvmField named Long fields. This eliminates all array bounds checks from the hot path. Files migrated (13 source + 7 test + 2 benchmark): - U256.kt, FieldP.kt, ScalarN.kt, Glv.kt, ECPoint.kt - FieldMulPlatform.kt (expect + 3 actuals), FieldMulFused.kt - PointTypes.kt (MutablePoint, AffinePoint, PointScratch) - KeyCodec.kt, Secp256k1.kt - All test files and benchmarks Bytecode impact: Before: 464 laload/lastore (bounds-checked) in core arithmetic After: 0 laload/lastore, all getfield/putfield (no checks) The public API (Secp256k1 object) is unchanged - it still accepts and returns ByteArray. Fe4 conversion happens at the API boundary via U256.fromBytes()/U256.toBytes(). All secp256k1 unit tests pass on JVM. https://claude.ai/code/session_01Sxi6Gpxbstuj3Y8TBY7XrU