[PATCH] D14845: [Support] Fix SaturatingMultiply<T>() to never cause overflow, Re-enable Unit Tests

David Li via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 19 16:02:41 PST 2015


davidxl added a comment.

integer division is expensive. I wonder if we can take some fast path to by pass it

T Upper = Max >> (sizeof(T)*4);
if (X <= Upper && Y <= Upper)

  return X * Y;

// regular stuff


http://reviews.llvm.org/D14845





More information about the llvm-commits mailing list