Fix int512 literal parsing and CMake package export#3
Conversation
PR Review: feature/fix-cmake → masterFiles changed: 3 (CMakeLists.txt, config.cmake.in, src/int512.h)Commits: 2Review date: 2026-05-13This branch contains two small, surgical fixes plus light reformatting:
Both fixes look correct and necessary. The interesting things to talk about are: Critical — likely bugs or consensus risksThis is a math/crypto library (BN256 curve), not blockchain consensus code, so the
|
PR Review (follow-up): feature/fix-cmake → masterNew commit reviewed: c1f6bcb ("address PR review feedback")Files changed in this commit: 4 (CMakeLists.txt, README.md, src/CMakeLists.txt, src/int512.h)Review date: 2026-05-13This follow-up commit addresses the four discussion points from the first review pass. Critical — likely bugs or consensus risksNone. Worth discussing — potential issues
|
Summary
Fixes int512 literal parsing and adjacent int512 operator bugs, corrects the installed and build-tree CMake package exports, and updates CI to use the current Ubuntu runner.
What changed
int512_tbinaryoperator|andoperator&to return the computed result.int512_t::operator>>for whole-limb and mixed limb/bit shifts.>>,|, and&behavior.src/int512.hand remove a stray semicolon.bn256::bn256.bn256-targets.cmakefrombn256-config.cmakeand callcheck_required_components(bn256).install(TARGETS bn256 ...)rules into the rootCMakeLists.txt.BN256_INSTALL_COMPONENTconsistently to headers, library, target exports, and package config files.2.0.2and sync the README version.Why
The previous int512 literal digit check used an impossible condition, so invalid decimal characters were accepted. Nearby binary bitwise operators also returned the wrong object, and right shifts dropped limbs when shifting by 64-bit boundaries.
The installed CMake package config was also not usable for downstream
find_package(bn256)consumers because it included the wrong generated file and did not expose a consistent namespaced target. The install rules had duplicate target installs and partial component handling, so this PR makes the package/export behavior consistent.Testing
cmake -S . -B build -DBN256_ENABLE_TEST=ONcmake --build buildctest --test-dir build --output-on-failurecmake --install build --prefix /tmp/bn256-pr3-install-DBN256_INSTALL_COMPONENT=runtimeNotes
Base branch:
masterHead branch:
feature/fix-cmake