[libc-commits] [PATCH] D140070: [libc] fix shifting exact multiples of 64 in uint

Tue Ly via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu Dec 15 06:43:42 PST 2022


lntue added inline comments.


================
Comment at: libc/src/__support/UInt.h:380
+        val[i] =
+            (val[j] << shift) | (shift == 0 ? 0 : (val[j - 1] >> (64 - shift)));
       }
----------------
Can you change it similar to the fix for shift right in https://reviews.llvm.org/D139566?  I.e., move the check for `shift == 0` or `shift > 0` outside of the loop?


================
Comment at: libc/src/__support/UInt.h:429
+          val[i] = (val[j] >> shift) |
+                   (shift == 0 ? 0 : (val[j + 1] << (64 - shift)));
         }
----------------
This is not needed as `shift` is guaranteed to be positive in line 426.  This was actually fixed in https://reviews.llvm.org/D139566


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140070/new/

https://reviews.llvm.org/D140070



More information about the libc-commits mailing list