[libc-commits] [PATCH] D138541: [libc][math] Implement full multiplication and quick_mul_hi for UInt class.

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Nov 30 00:41:32 PST 2022


sivachandra added inline comments.


================
Comment at: libc/src/__support/UInt.h:219
+  // Fast hi part of the full product.  Differ with the truncation from full
+  // multiplication by at most 1 last bit.
+  constexpr UInt<Bits> quick_mul_hi(const UInt<Bits> &other) const {
----------------
Can you add more commentary here explaining how this is different from `operator*`? IIUC, `operator*` returns the LS `Bits` of the result, while this is will return the MS `Bits` of the result with an additional condition that the LS-Bit of the result need not be the same as that in the MS `Bits` of the result produced by `ful_mul`.


================
Comment at: libc/test/src/__support/uint_test.cpp:491
+}
\ No newline at end of file

----------------
Please fix.


================
Comment at: libc/utils/UnitTest/LibcTest.cpp:294
+    __llvm_libc::cpp::UInt<320> RHS, const char *LHSStr, const char *RHSStr,
+    const char *File, unsigned long Line);
+
----------------
While OK for this change, I think this is going beyond manageable limits. We should refactor the test infrastructure with some urgency so that we can put these specializations next to the special types.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138541



More information about the libc-commits mailing list