fast floor

ponce contact at gam3sfrommars.fr
Sun Oct 13 11:15:14 PDT 2013


On Thursday, 10 October 2013 at 22:27:14 UTC, Spacen Jasset wrote:
> Hello,
>
> I am after a fast floor function; In fact a fast truncation and 
> conversion to integer. I see that std.math takes a real, and 
> that std.c.math takes a double.
>
> Is there a quicker function, and what might cast(int)1.5f do?
>
> Regards,
>
> Spacen.

If you don't need to handle negatives, I suggest you simply use a 
cast(int) since truncation has both a x87 instruction (FISTTP) 
and a SSE instruction (CVTTSS2SI).


More information about the Digitalmars-d-learn mailing list