CTFE pow()

Daniel Murphy via Digitalmars-d digitalmars-d at puremagic.com
Fri Jan 2 00:52:50 PST 2015


"Xinok"  wrote in message news:pbjttgrpwhsffoovpida at forum.dlang.org...

> I'm wondering if there's any added benefit to implementing these as 
> intrinsic functions instead? In this way, implementing them in CTFE should 
> be trivial and the extra knowledge given to the compiler could enable 
> extra optimizations that wouldn't be possible otherwise. For example, the 
> compiler understands multiplication and division so, in certain cases, it 
> can replace these operations with bit-shifting which is faster.

I was just about to suggest this.  Another easy way might be to just add 
get/set mantissa/exponent intrinsics and use those in the ctfe versions. 



More information about the Digitalmars-d mailing list