[all-commits] [llvm/llvm-project] 44bf4c: [libc] Fix float to string conversion in 32-bit sy...

Mikhail R. Gadelha via All-commits all-commits at lists.llvm.org
Wed Aug 2 05:51:24 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 44bf4c8944f5496b626958ffe9f29da182f4d9d8
      https://github.com/llvm/llvm-project/commit/44bf4c8944f5496b626958ffe9f29da182f4d9d8
  Author: Mikhail R. Gadelha <mikhail at igalia.com>
  Date:   2023-08-02 (Wed, 02 Aug 2023)

  Changed paths:
    M libc/src/__support/float_to_string.h

  Log Message:
  -----------
  [libc] Fix float to string conversion in 32-bit systems

In 32-bit systems, sizeof(size_t) is 4, so we fail to build an 128-bit
integer in mul_shift_mod_1e9, which ends up ignoring the top bits in the
mantissa.

This patch fixes the issue by calling the Uint constructor directly. If
it's a system that supports 128-bit integers, the constructor that takes
a value will be called, if the system doesn't support 128-bit integers
(like rv32), mantissa is already a UInt.

Reviewed By: lntue, michaelrj

Differential Revision: https://reviews.llvm.org/D156813




More information about the All-commits mailing list