A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://lists.llvm.org/pipermail/llvm-dev/2020-July/143316.html below:

[llvm-dev] Is there a simple way to check APInt multiplication overflow?

[llvm-dev] Is there a simple way to check APInt multiplication overflow? [llvm-dev] Is there a simple way to check APInt multiplication overflow?Ben Shi via llvm-dev llvm-dev at lists.llvm.org
Sat Jul 11 04:48:34 PDT 2020
Hello,


I have two APInt variables, which are got by ConstantSDNode::getAPIntValue().


Is there a simple way to know if their multiplication overflows?


For example, if both APInt vars contain a int32_t, 
APInt a, b;
Then I think 


if (a.getMinSignedBits() + b.getMinSignedBits() > 32)
   a*b must exceeds int32_t <=> overflow happens;


Is my way OK?


Ben Shi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200711/f03a8973/attachment.html>
More information about the llvm-dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4