[all-commits] [llvm/llvm-project] b00e44: [libc][NFC] Make EXPONENT_BIAS int32_t (#75046)

Guillaume Chatelet via All-commits all-commits at lists.llvm.org
Tue Dec 12 04:03:40 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b00e445c4d52bf630147584109a9599004d30b4c
      https://github.com/llvm/llvm-project/commit/b00e445c4d52bf630147584109a9599004d30b4c
  Author: Guillaume Chatelet <gchatelet at google.com>
  Date:   2023-12-12 (Tue, 12 Dec 2023)

  Changed paths:
    M libc/src/__support/FPUtil/FloatProperties.h
    M libc/src/__support/detailed_powers_of_ten.h
    M libc/src/__support/str_to_float.h
    M libc/src/math/generic/powf.cpp

  Log Message:
  -----------
  [libc][NFC] Make EXPONENT_BIAS int32_t (#75046)

`EXPONENT_BIAS` is almost always used with signed arithmetic. Making it
an `int32_t` from the start reduces the chances to run into
implementation defined behavior (cast from unsigned to signed is
implementation-defined until C++20).


https://en.cppreference.com/w/cpp/language/implicit_conversion#:~:text=If%20the%20destination%20type%20is%20signed,arithmetic%20overflow%2C%20which%20is%20undefined).




More information about the All-commits mailing list