[cfe-commits] r146482 - /cfe/trunk/lib/AST/ASTContext.cpp
clattner at apple.com
Tue Dec 13 10:56:45 PST 2011
On Dec 13, 2011, at 10:47 AM, Marshall Clow wrote:
> On Dec 13, 2011, at 10:34 AM, Chris Lattner wrote:
>> Honest question: why would that be better?
> Because using
> makes two assumptions, both of which are almost always true:
> * That an "all ones" representation is the max value for uint64_t
> and * That the conversion from (int) -1 ==> uint64_t produces the bit patten that you think you want.
> What the code wants here is not really an "all ones" pattern, but rather the max value.
> And the standard library has a defined, portable way of getting the max value.
> On most machines, it will be 0xFFFFFFFFFFFFFFFF (i.e, all ones) and the code that I suggest replacing will work.
LLVM doesn't care about non-two's complement machines. On any sane system, your fears are unfounded. The value being sought is *always* 18446744073709551615.
More information about the cfe-commits