Wrote a blog post about CTFE and D

Danny Arends Danny.Arends at gmail.com
Thu Aug 30 10:10:17 PDT 2012


On Thursday, 30 August 2012 at 16:27:05 UTC, Dmitry Olshansky 
wrote:
> On 30-Aug-12 13:41, Danny Arends wrote:
>> I wrote a blog post about the stuff I've been doing last 
>> weekend using
>> CTFE.
>> All comments are welcome, you can find the blog post at:
>>
>> http://www.dannyarends.nl/index.cgi?viewDetailed=00029
>>
>> Danny Arends
>> http://www.dannyarends.nl
>
> Nice read.
>
> A couple of nits:
>
> Use T[2] for fixed arrays like Cord one. It also helps 
> tremendously for lookup speed of the final lookup table. Thus 
> instead of array of arrays you'd have an array of pairs i.e. 2 
> indirections ---> 1 indirection and cache friendly layout.

You're right about that, I made it initially to be variable 
length. because I was also planning on storing the other ones 
(tan, cosh, sinh) but didn't get around to that yet.

>
> And an awful typo in degreeloop function I think:
> pure int degreeloop(int deg){
>   while(deg < 0 || deg >= 360){
>     if(deg < 0) deg += 360;
>     if(deg >= 0) deg -= 360; //shouldn't it be >= 360 ??
>   }
>   return deg;
> }

Thanks for the spot ;) it actually doesn't matter seeing as the 
while condition already forced it to be out of array bounds. I 
could just as well use an else

Thanks for the feedback !

And I'll create a blog post about the rotation matrices also when
I finish off that code

Danny Arends
http://www.dannyarends.nl


More information about the Digitalmars-d-announce mailing list