Implicit integer casting

James Miller james at aatch.net
Sun Mar 18 19:46:56 PDT 2012


>> Another thing I have noticed, is that that compared to a cast,
>> to!<type>  is incredibly slow. Most of the time it doesn't matter, but
>> I was doing some work with noise generation, and found that casting
>> the floats to integers was an order of magnitude faster than using
>> to!int.
>
>
> There's a check involved, and possibly inlining doesn't make it for whatever
> reason.
>
> Andrei

Oh, I wasn't complaining, more just making an observation that the
safe to!<type> is slower than an unsafe cast. Probably obvious, but
worth mentioning nonetheless.

--
James Miller


More information about the Digitalmars-d mailing list