Re: [AD] a fix struct for dallegro

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 2007-04-15, torhus@xxxxxxxxxx <torhus@xxxxxxxxxx> wrote:
> 
> Since fixed is just an alias for int, there's still the danger of mixing 
> fixed and int values.  So this solution isn't perfect.  I tried making 
> fixed a D typedef, which would make it a completely distinct type from 
> int.  But that requires a lot of casting when using it.

In what cases?  I would think that most uses of fixed would require
itofix, ftofix, fixtoi or fixtof calls anyway.

>    fix sqrt()          { fix t;  t.value = fixsqrt(value);    return t; }
>    fix cos()           { fix t;  t.value = fixcos(value);     return t; }
>    fix sin()           { fix t;  t.value = fixsin(value);     return t; }
>    fix tan()           { fix t;  t.value = fixtan(value);     return t; }
>    fix acos()          { fix t;  t.value = fixacos(value);    return t; }
>    fix asin()          { fix t;  t.value = fixasin(value);    return t; }
>    fix atan()          { fix t;  t.value = fixatan(value);    return t; }
>    fix atan2(fix x)    { fix t;  t.value = fixatan2(value, x.value);  return t; }

Are these necessary?

Peter





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/