[LLVMdev] Truncate float to int?

Eli Friedman eli.friedman at gmail.com
Tue Jun 3 12:48:34 PDT 2008


On Tue, Jun 3, 2008 at 11:32 AM, Mark Leone <markleone at gmail.com> wrote:
> Newbie question here:  what's the best way to truncate a float to a
> signed int?  The fptosi instruction rounds, and the fptrunc
> instruction simply truncates from a large float type to a smaller
> float type.

fptosi is equivalent to a C cast from float to int.

-Eli



More information about the llvm-dev mailing list