Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2471 for code


Ignore:
Timestamp:
Dec 15, 2008, 9:56:08 PM (16 years ago)
Author:
landauf
Message:

changed lines 230-235 (everything else is just whitespace)
this fixes a strange problem with mingw

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation/src/bullet/LinearMath/btScalar.h

    r2459 r2471  
    44This software is provided 'as-is', without any express or implied warranty.
    55In no event will the authors be held liable for any damages arising from the use of this software.
    6 Permission is granted to anyone to use this software for any purpose, 
    7 including commercial applications, and to alter it and redistribute it freely, 
     6Permission is granted to anyone to use this software for any purpose,
     7including commercial applications, and to alter it and redistribute it freely,
    88subject to the following restrictions:
    99
     
    7979
    8080#else
    81        
     81
    8282#if defined     (__CELLOS_LV2__)
    8383                #define SIMD_FORCE_INLINE inline
     
    119119                #define btLikely(_c)   __builtin_expect((_c), 1)
    120120                #define btUnlikely(_c) __builtin_expect((_c), 0)
    121                
     121
    122122
    123123#else
     
    179179
    180180#if defined(BT_USE_DOUBLE_PRECISION) || defined(BT_FORCE_DOUBLE_FUNCTIONS)
    181                
     181
    182182SIMD_FORCE_INLINE btScalar btSqrt(btScalar x) { return sqrt(x); }
    183183SIMD_FORCE_INLINE btScalar btFabs(btScalar x) { return fabs(x); }
     
    194194
    195195#else
    196                
    197 SIMD_FORCE_INLINE btScalar btSqrt(btScalar y) 
    198 { 
     196
     197SIMD_FORCE_INLINE btScalar btSqrt(btScalar y)
     198{
    199199#ifdef USE_APPROXIMATION
    200200    double x, z, tempf;
     
    212212        return x*y;
    213213#else
    214         return sqrtf(y); 
     214        return sqrtf(y);
    215215#endif
    216216}
     
    219219SIMD_FORCE_INLINE btScalar btSin(btScalar x) { return sinf(x); }
    220220SIMD_FORCE_INLINE btScalar btTan(btScalar x) { return tanf(x); }
    221 SIMD_FORCE_INLINE btScalar btAcos(btScalar x) { 
     221SIMD_FORCE_INLINE btScalar btAcos(btScalar x) {
    222222        btAssert(x <= btScalar(1.));
    223         return acosf(x); 
     223        return acosf(x);
    224224}
    225225SIMD_FORCE_INLINE btScalar btAsin(btScalar x) { return asinf(x); }
     
    228228SIMD_FORCE_INLINE btScalar btExp(btScalar x) { return expf(x); }
    229229SIMD_FORCE_INLINE btScalar btLog(btScalar x) { return logf(x); }
    230 SIMD_FORCE_INLINE btScalar btPow(btScalar x,btScalar y) { return powf(x,y); }
    231        
     230  #if defined( __MINGW32__ )
     231  SIMD_FORCE_INLINE btScalar btPow(btScalar x,btScalar y) { return pow(x,y); }
     232  #else
     233  SIMD_FORCE_INLINE btScalar btPow(btScalar x,btScalar y) { return powf(x,y); }
     234  #endif
     235
    232236#endif
    233237
     
    246250#endif
    247251
    248 SIMD_FORCE_INLINE btScalar btAtan2Fast(btScalar y, btScalar x) 
     252SIMD_FORCE_INLINE btScalar btAtan2Fast(btScalar y, btScalar x)
    249253{
    250254        btScalar coeff_1 = SIMD_PI / 4.0f;
     
    304308///btSelect avoids branches, which makes performance much better for consoles like Playstation 3 and XBox 360
    305309///Thanks Phil Knight. See also http://www.cellperformance.com/articles/2006/04/more_techniques_for_eliminatin_1.html
    306 SIMD_FORCE_INLINE unsigned btSelect(unsigned condition, unsigned valueIfConditionNonZero, unsigned valueIfConditionZero) 
     310SIMD_FORCE_INLINE unsigned btSelect(unsigned condition, unsigned valueIfConditionNonZero, unsigned valueIfConditionZero)
    307311{
    308312    // Set testNz to 0xFFFFFFFF if condition is nonzero, 0x00000000 if condition is zero
    309313    // Rely on positive value or'ed with its negative having sign bit on
    310     // and zero value or'ed with its negative (which is still zero) having sign bit off 
     314    // and zero value or'ed with its negative (which is still zero) having sign bit off
    311315    // Use arithmetic shift right, shifting the sign bit through all 32 bits
    312316    unsigned testNz = (unsigned)(((int)condition | -(int)condition) >> 31);
    313317    unsigned testEqz = ~testNz;
    314     return ((valueIfConditionNonZero & testNz) | (valueIfConditionZero & testEqz)); 
     318    return ((valueIfConditionNonZero & testNz) | (valueIfConditionZero & testEqz));
    315319}
    316320SIMD_FORCE_INLINE int btSelect(unsigned condition, int valueIfConditionNonZero, int valueIfConditionZero)
    317321{
    318322    unsigned testNz = (unsigned)(((int)condition | -(int)condition) >> 31);
    319     unsigned testEqz = ~testNz; 
     323    unsigned testEqz = ~testNz;
    320324    return static_cast<int>((valueIfConditionNonZero & testNz) | (valueIfConditionZero & testEqz));
    321325}
     
    325329    return (float)btFsel((btScalar)condition - btScalar(1.0f), valueIfConditionNonZero, valueIfConditionZero);
    326330#else
    327     return (condition != 0) ? valueIfConditionNonZero : valueIfConditionZero; 
     331    return (condition != 0) ? valueIfConditionNonZero : valueIfConditionZero;
    328332#endif
    329333}
     
    360364///btSwapFloat uses using char pointers to swap the endianness
    361365////btSwapFloat/btSwapDouble will NOT return a float, because the machine might 'correct' invalid floating point values
    362 ///Not all values of sign/exponent/mantissa are valid floating point numbers according to IEEE 754. 
    363 ///When a floating point unit is faced with an invalid value, it may actually change the value, or worse, throw an exception. 
    364 ///In most systems, running user mode code, you wouldn't get an exception, but instead the hardware/os/runtime will 'fix' the number for you. 
     366///Not all values of sign/exponent/mantissa are valid floating point numbers according to IEEE 754.
     367///When a floating point unit is faced with an invalid value, it may actually change the value, or worse, throw an exception.
     368///In most systems, running user mode code, you wouldn't get an exception, but instead the hardware/os/runtime will 'fix' the number for you.
    365369///so instead of returning a float/double, we return integer/long long integer
    366370SIMD_FORCE_INLINE unsigned int  btSwapEndianFloat(float d)
     
    378382
    379383// unswap using char pointers
    380 SIMD_FORCE_INLINE float btUnswapEndianFloat(unsigned int a) 
     384SIMD_FORCE_INLINE float btUnswapEndianFloat(unsigned int a)
    381385{
    382386    float d = 0.0f;
     
    410414
    411415// unswap using char pointers
    412 SIMD_FORCE_INLINE double btUnswapEndianDouble(const unsigned char *src) 
     416SIMD_FORCE_INLINE double btUnswapEndianDouble(const unsigned char *src)
    413417{
    414418    double d = 0.0;
Note: See TracChangeset for help on using the changeset viewer.