[LLVMdev] Complex constant expressions?

Dale Johannesen dalej at apple.com
Wed Jan 23 09:25:33 PST 2008


On Jan 23, 2008, at 5:10 AM, Neil Booth wrote:

> Talin wrote:-
>>    APInt convertToAPInt() const;
>>
>> The last function doesn't appear to convert the APFloat into the  
>> nearest
>> integer equivalent, since my experiments with it returned completely
>> unexpected values; I'm assuming that what is returned is an APInt
>> containing the bitwise representation of the floating-point value?
>
> Only two convert to integer.  The convertToAPInt is unfortunately
> named; I'm not sure what it does but suspect it captures bitpatterns
> like you suggest.

It's described pretty well, I thought:

// This function creates an APInt that is just a bit map of the floating
// point constant as it would appear in memory.  It is not a conversion,
// and treating the result as a normal integer is unlikely to be useful.

APInt
APFloat::convertToAPInt() const
{
....




More information about the llvm-dev mailing list