[all-commits] [llvm/llvm-project] c4b7e8: [libc] fix shifting exact multiples of 64 in uint

michaelrj-google via All-commits all-commits at lists.llvm.org
Thu Dec 15 13:01:44 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c4b7e8a035d524c797bed79b3c7aeae0707e07b5
      https://github.com/llvm/llvm-project/commit/c4b7e8a035d524c797bed79b3c7aeae0707e07b5
  Author: Michael Jones <michaelrj at google.com>
  Date:   2022-12-15 (Thu, 15 Dec 2022)

  Changed paths:
    M libc/src/__support/UInt.h
    M libc/test/src/__support/uint_test.cpp

  Log Message:
  -----------
  [libc] fix shifting exact multiples of 64 in uint

The internal uint class had a bug introduced recently when optimizing
the shift routines. When calculating the value of a block, it would
shift an adjacent block by 64 - the shift amount. If the shift amount
was 0, this would be a shift of 64, which is undefined for a 64 bit
integer. This patch fixes this by adding a conditional to catch this
case.

Reviewed By: lntue

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




More information about the All-commits mailing list