V3.99: supporting cross-platform BlockType == uint64_t#511
Conversation
blockbinary::operator[] is a block/limb index accessor, not a bit index accessor. Four locations used it with bit indices, causing stack-buffer-overflow for posit configurations where fbits > nrBlocks (e.g., posit<16,1,uint8_t> with fbits=12 and only 2 blocks). Fixed positFraction::operator<<, get_fixed_point(), denormalize(), and posit reciprocal sign extraction to use _block.test(bitIndex). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Why/what/how markdown guides for each of the 29 number systems with regression tests, covering integer, fixed-point, rational, configurable floats, posit family, logarithmic, multi-component extended precision, block-scaled AI formats, interval arithmetic, and compressed floating-point. Includes README.md index with category tables and selection guide. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
0x0Fu is a 32-bit unsigned int, so shifting it by nibbleIndexInWord*4 when nibbleIndexInWord >= 8 (i.e., shift >= 32) is undefined behavior. On MSVC this caused corrupt to_hex() output and cascading test failures in bb_uint64_limbs. Fix by casting to bt before shifting, ensuring the shift operates on the block type width. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
_umul128, _addcarry_u64, and _subborrow_u64 write results through pointer parameters. When these pointers were derived from reference parameters via reinterpret_cast, the MSVC optimizer could lose the writes after inlining, causing mul128 to always return hi=0. This produced systematically wrong multiplication results (block[1] only contained the addcarry carry-out bit, not the mul128 high product). Fix: use local variables for all intrinsic output pointers, then assign to the reference parameters after the intrinsic returns. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…dcarry The multiplication loop accumulated carries as full 64-bit values (hi + c1) then passed them as carry_in to addcarry(). On MSVC, _addcarry_u64 truncates carry_in to unsigned char, silently losing the upper bits. Split into two separate addcarry calls each with carry_in=0 so the multi-bit carry is added as a regular operand. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Posit: add long double constructor/operator= in the #else branch of LONG_DOUBLE_SUPPORT so MSVC (where long double is a distinct type but same precision as double) no longer hits ambiguous overload resolution. Directives: define _USE_MATH_DEFINES for MSVC so M_PI is available from <cmath> without per-file defines. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove redundant long double constructor/assignment in posit #else branch that caused ambiguous overload on MSVC where long double == double. Replace ternary with if-constexpr helper in zfp_codec encode/decode to avoid C4293 warning when N == 64. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…r overload resolution MSVC treats long double and double as distinct types for overload resolution despite identical representation. Without explicit long double overloads, assignment from long double is ambiguous among float/double/integer candidates. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review infoConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (52)
📝 WalkthroughWalkthroughVersion bump to v3.99 with bug fixes for blockbinary bit-access misuse and reciprocal sign extraction. Adds 64-bit limb carry intrinsics for multi-block arithmetic optimization. Introduces extensive documentation for Universal's number system types and new validation tests for uint64_t limb configurations. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Poem
✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Pull Request Test Coverage Report for Build 22332889654Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
Supporting uint64_t blocktype across the different platforms.
Summary by CodeRabbit
Release Notes v3.99
Bug Fixes
Documentation
Performance