[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
       
    Fri Dec  2 11:13:00 PST 2022
    
    
  
sivachandra accepted this revision.
sivachandra added inline comments.
This revision is now accepted and ready to land.
================
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 {
----------------
sivachandra wrote:
> 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`.
Add an example of where this kind of multiplication will be useful.
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