Changeset 2321


Ignore:
Timestamp:
Feb 2, 2013, 7:28:21 PM (6 years ago)
Author:
sam
Message:

math: friend declarations aren’t proper declarations; add the
required declarations for real free functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lol/math/real.h

    r2317 r2321  
    7777
    7878    /* Comparison functions */
    79     template<int M> friend Real<M> min(Real<M> const &a, Real<M> const &b);
    80     template<int M> friend Real<M> max(Real<M> const &a, Real<M> const &b);
    81     template<int M> friend Real<M> clamp(Real<M> const &x,
    82                                          Real<M> const &a, Real<M> const &b);
     79    template<int K> friend Real<K> min(Real<K> const &a, Real<K> const &b);
     80    template<int K> friend Real<K> max(Real<K> const &a, Real<K> const &b);
     81    template<int K> friend Real<K> clamp(Real<K> const &x,
     82                                         Real<K> const &a, Real<K> const &b);
    8383
    8484    /* Trigonometric functions */
    85     template<int M> friend Real<M> sin(Real<M> const &x);
    86     template<int M> friend Real<M> cos(Real<M> const &x);
    87     template<int M> friend Real<M> tan(Real<M> const &x);
    88     template<int M> friend Real<M> asin(Real<M> const &x);
    89     template<int M> friend Real<M> acos(Real<M> const &x);
    90     template<int M> friend Real<M> atan(Real<M> const &x);
    91     template<int M> friend Real<M> atan2(Real<M> const &y, Real<M> const &x);
     85    template<int K> friend Real<K> sin(Real<K> const &x);
     86    template<int K> friend Real<K> cos(Real<K> const &x);
     87    template<int K> friend Real<K> tan(Real<K> const &x);
     88    template<int K> friend Real<K> asin(Real<K> const &x);
     89    template<int K> friend Real<K> acos(Real<K> const &x);
     90    template<int K> friend Real<K> atan(Real<K> const &x);
     91    template<int K> friend Real<K> atan2(Real<K> const &y, Real<K> const &x);
    9292
    9393    /* Hyperbolic functions */
    94     template<int M> friend Real<M> sinh(Real<M> const &x);
    95     template<int M> friend Real<M> cosh(Real<M> const &x);
    96     template<int M> friend Real<M> tanh(Real<M> const &x);
     94    template<int K> friend Real<K> sinh(Real<K> const &x);
     95    template<int K> friend Real<K> cosh(Real<K> const &x);
     96    template<int K> friend Real<K> tanh(Real<K> const &x);
    9797
    9898    /* Exponential and logarithmic functions */
    99     template<int M> friend Real<M> exp(Real<M> const &x);
    100     template<int M> friend Real<M> exp2(Real<M> const &x);
    101     template<int M> friend Real<M> log(Real<M> const &x);
    102     template<int M> friend Real<M> log2(Real<M> const &x);
    103     template<int M> friend Real<M> log10(Real<M> const &x);
    104     template<int M> friend Real<M> frexp(Real<M> const &x, int *exp);
    105     template<int M> friend Real<M> ldexp(Real<M> const &x, int exp);
    106     template<int M> friend Real<M> modf(Real<M> const &x, Real<M> *iptr);
    107     template<int M> friend Real<M> ulp(Real<M> const &x);
    108     template<int M> friend Real<M> nextafter(Real<M> const &x, Real<M> const &y);
     99    template<int K> friend Real<K> exp(Real<K> const &x);
     100    template<int K> friend Real<K> exp2(Real<K> const &x);
     101    template<int K> friend Real<K> log(Real<K> const &x);
     102    template<int K> friend Real<K> log2(Real<K> const &x);
     103    template<int K> friend Real<K> log10(Real<K> const &x);
     104    template<int K> friend Real<K> frexp(Real<K> const &x, int *exp);
     105    template<int K> friend Real<K> ldexp(Real<K> const &x, int exp);
     106    template<int K> friend Real<K> modf(Real<K> const &x, Real<K> *iptr);
     107    template<int K> friend Real<K> ulp(Real<K> const &x);
     108    template<int K> friend Real<K> nextafter(Real<K> const &x, Real<K> const &y);
    109109
    110110    /* Power functions */
    111     template<int M> friend Real<M> re(Real<M> const &x);
    112     template<int M> friend Real<M> sqrt(Real<M> const &x);
    113     template<int M> friend Real<M> cbrt(Real<M> const &x);
    114     template<int M> friend Real<M> pow(Real<M> const &x, Real<M> const &y);
    115     template<int M> friend Real<M> gamma(Real<M> const &x);
     111    template<int K> friend Real<K> re(Real<K> const &x);
     112    template<int K> friend Real<K> sqrt(Real<K> const &x);
     113    template<int K> friend Real<K> cbrt(Real<K> const &x);
     114    template<int K> friend Real<K> pow(Real<K> const &x, Real<K> const &y);
     115    template<int K> friend Real<K> gamma(Real<K> const &x);
    116116
    117117    /* Rounding, absolute value, remainder etc. */
    118     template<int M> friend Real<M> ceil(Real<M> const &x);
    119     template<int M> friend Real<M> copysign(Real<M> const &x, Real<M> const &y);
    120     template<int M> friend Real<M> floor(Real<M> const &x);
    121     template<int M> friend Real<M> fabs(Real<M> const &x);
    122     template<int M> friend Real<M> round(Real<M> const &x);
    123     template<int M> friend Real<M> fmod(Real<M> const &x, Real<N> const &y);
     118    template<int K> friend Real<K> ceil(Real<K> const &x);
     119    template<int K> friend Real<K> copysign(Real<K> const &x, Real<K> const &y);
     120    template<int K> friend Real<K> floor(Real<K> const &x);
     121    template<int K> friend Real<K> fabs(Real<K> const &x);
     122    template<int K> friend Real<K> round(Real<K> const &x);
     123    template<int K> friend Real<K> fmod(Real<K> const &x, Real<K> const &y);
    124124
    125125    /* Functions inherited from GLSL */
    126     template<int M> friend Real<M> abs(Real<M> const &x);
    127     template<int M> friend Real<M> fract(Real<M> const &x);
     126    template<int K> friend Real<K> abs(Real<K> const &x);
     127    template<int K> friend Real<K> fract(Real<K> const &x);
    128128
    129129    void hexprint() const;
     
    238238template<> bool real::operator !() const;
    239239template<> real::operator bool() const;
     240
     241template<int K> Real<K> min(Real<K> const &a, Real<K> const &b);
     242template<int K> Real<K> max(Real<K> const &a, Real<K> const &b);
     243template<int K> Real<K> clamp(Real<K> const &x,
     244                              Real<K> const &a, Real<K> const &b);
     245
     246template<int K> Real<K> sin(Real<K> const &x);
     247template<int K> Real<K> cos(Real<K> const &x);
     248template<int K> Real<K> tan(Real<K> const &x);
     249template<int K> Real<K> asin(Real<K> const &x);
     250template<int K> Real<K> acos(Real<K> const &x);
     251template<int K> Real<K> atan(Real<K> const &x);
     252template<int K> Real<K> atan2(Real<K> const &y, Real<K> const &x);
     253template<int K> Real<K> sinh(Real<K> const &x);
     254template<int K> Real<K> cosh(Real<K> const &x);
     255template<int K> Real<K> tanh(Real<K> const &x);
     256template<int K> Real<K> exp(Real<K> const &x);
     257template<int K> Real<K> exp2(Real<K> const &x);
     258template<int K> Real<K> log(Real<K> const &x);
     259template<int K> Real<K> log2(Real<K> const &x);
     260template<int K> Real<K> log10(Real<K> const &x);
     261template<int K> Real<K> frexp(Real<K> const &x, int *exp);
     262template<int K> Real<K> ldexp(Real<K> const &x, int exp);
     263template<int K> Real<K> modf(Real<K> const &x, Real<K> *iptr);
     264template<int K> Real<K> ulp(Real<K> const &x);
     265template<int K> Real<K> nextafter(Real<K> const &x, Real<K> const &y);
     266template<int K> Real<K> re(Real<K> const &x);
     267template<int K> Real<K> sqrt(Real<K> const &x);
     268template<int K> Real<K> cbrt(Real<K> const &x);
     269template<int K> Real<K> pow(Real<K> const &x, Real<K> const &y);
     270template<int K> Real<K> gamma(Real<K> const &x);
     271template<int K> Real<K> ceil(Real<K> const &x);
     272template<int K> Real<K> copysign(Real<K> const &x, Real<K> const &y);
     273template<int K> Real<K> floor(Real<K> const &x);
     274template<int K> Real<K> fabs(Real<K> const &x);
     275template<int K> Real<K> round(Real<K> const &x);
     276template<int K> Real<K> fmod(Real<K> const &x, Real<K> const &y);
     277template<int K> Real<K> abs(Real<K> const &x);
     278template<int K> Real<K> fract(Real<K> const &x);
    240279
    241280template<> real min(real const &a, real const &b);
     
    279318template<> void real::hexprint() const;
    280319template<> void real::print(int ndigits) const;
     320template<> void real::sprintf(char *str, int ndigits) const;
    281321
    282322} /* namespace lol */
Note: See TracChangeset for help on using the changeset viewer.