[PATCH][lld] ELF/AArch64: Add support for checking for ABS32 overflow

Benjamin Kramer benny.kra at gmail.com
Mon Jan 26 10:28:11 PST 2015


> On 26.01.2015, at 19:12, Tim Northover <t.p.northover at gmail.com> wrote:
> 
>> +/// \brief Check X is in the interval (-2^(bits-1), 2^bits]
>> +bool withinSignedUnsignedRange(int64_t X, int bits) {
> 
> This should probably be a static function.
> 
>> +  if (X < -(1L << (bits - 1)) || X >= (1L << bits))
> 
> I think long is only 32-bits on Windows, so we should use 1LL (and
> assert that Bits < 64, just in case someone tries to extend its use
> carelessly later).

We have isInt and isIntN in MathExtras.h for this.

- Ben




More information about the llvm-commits mailing list