Open Source
C++ Formatting Library

fmt

A 32-bit i686 fallback uint128 bug corrupted high-word behavior in hexadecimal floating formatting.

Pull Request

32-bit Bug

  • fmt hexadecimal floating formatting failed on 32-bit i686 fallback uint128 behavior.
  • The bug was architecture-specific, so 64-bit validation alone could miss it.

Investigation

  • Narrowed the failure to fallback uint128 operations used by format_hexfloat.
  • Compared behavior between 32-bit and 64-bit builds to isolate the high-word corruption.

Root Cause

  • format_hexfloat masked rounded bits with bitwise NOT.
  • The fallback operator~ truncated to 32 bits, corrupting the high word.

Fix

  • Corrected fallback uint128 bitwise behavior so high-word state survives the operation.
  • Kept the change constrained to the fallback path that exposed the issue.

Validation

  • Validated across 32-bit and 64-bit architectures.
  • Confirmed the fix addressed the architecture-specific failure rather than only the local symptom.

Pull Request

  • Submitted a focused patch with root cause context.
  • Documented the architecture-specific failure mode for maintainers.