Changeset 3290

Show
Ignore:
Timestamp:
08/16/04 23:03:41 (10 years ago)
Author:
robert
Message:

Added a handling of different hex long long handling for VS and non
VS.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osg/dxtctool.h

    r3288 r3290  
    4545 
    4646#if !defined(_MSC_VER) 
    47 typedef char        __int8; 
    48 typedef short       __int16; 
    49 typedef int         __int32; 
    50 typedef long long   __int64; 
     47 
     48    typedef char        __int8; 
     49    typedef short       __int16; 
     50    typedef int         __int32; 
     51    typedef long long   __int64; 
     52 
     53    #define HEX_0x000000000000FFFF 0x000000000000FFFFll 
     54    #define HEX_0x000000000FFF0000 0x000000000FFF0000ll 
     55    #define HEX_0x000000FFF0000000 0x000000FFF0000000ll 
     56    #define HEX_0x000FFF0000000000 0x000FFF0000000000ll 
     57    #define HEX_0xFFF0000000000000 0xFFF0000000000000ll 
     58 
     59#else 
     60 
     61    #define HEX_0x000000000000FFFF 0x000000000000FFFF 
     62    #define HEX_0x000000000FFF0000 0x000000000FFF0000 
     63    #define HEX_0x000000FFF0000000 0x000000FFF0000000 
     64    #define HEX_0x000FFF0000000000 0x000FFF0000000000 
     65    #define HEX_0xFFF0000000000000 0xFFF0000000000000 
     66 
    5167#endif 
    5268 
     
    227243 
    228244 
     245 
     246 
     247 
     248 
    229249inline void dxtc_pixels::BVF_Alpha_DXT5_H4(void * const pBlock) const { 
    230250        // Swap the the first row of pixels with the last one, then the 2 middle row of pixels (tricky again) 
    231251        __int64 * const pB = (__int64 * const) pBlock; 
    232252 
    233         __int64 TmpQWord = (pB[0] & 0x000000000000FFFFll); 
    234         TmpQWord |= (pB[0] & 0x000000000FFF0000ll) << 36; 
    235         TmpQWord |= (pB[0] & 0x000000FFF0000000ll) << 12; 
    236         TmpQWord |= (pB[0] & 0x000FFF0000000000ll) >> 12; 
    237         TmpQWord |= (pB[0] & 0xFFF0000000000000ll) >> 36; 
     253        __int64 TmpQWord = (pB[0] & HEX_0x000000000000FFFF); 
     254        TmpQWord |= (pB[0] & HEX_0x000000000FFF0000) << 36; 
     255        TmpQWord |= (pB[0] & HEX_0x000000FFF0000000) << 12; 
     256        TmpQWord |= (pB[0] & HEX_0x000FFF0000000000) >> 12; 
     257        TmpQWord |= (pB[0] & HEX_0xFFF0000000000000) >> 36; 
    238258        pB[0] = TmpQWord; 
    239259} 
     
    245265        __int64 * const pB2 = (__int64 * const) pBlock2; 
    246266 
    247         __int64 TmpQWord1 = (pB1[0] & 0x000000000000FFFFll); 
    248         TmpQWord1 |= (pB1[0] & 0x000000000FFF0000ll) << 36; 
    249         TmpQWord1 |= (pB1[0] & 0x000000FFF0000000ll) << 12; 
    250         TmpQWord1 |= (pB1[0] & 0x000FFF0000000000ll) >> 12; 
    251         TmpQWord1 |= (pB1[0] & 0xFFF0000000000000ll) >> 36; 
    252  
    253         __int64 TmpQWord2 = (pB2[0] & 0x000000000000FFFFll); 
    254         TmpQWord2 |= (pB2[0] & 0x000000000FFF0000ll) << 36; 
    255         TmpQWord2 |= (pB2[0] & 0x000000FFF0000000ll) << 12; 
    256         TmpQWord2 |= (pB2[0] & 0x000FFF0000000000ll) >> 12; 
    257         TmpQWord2 |= (pB2[0] & 0xFFF0000000000000ll) >> 36; 
     267        __int64 TmpQWord1 = (pB1[0] & HEX_0x000000000000FFFF); 
     268        TmpQWord1 |= (pB1[0] & HEX_0x000000000FFF0000) << 36; 
     269        TmpQWord1 |= (pB1[0] & HEX_0x000000FFF0000000) << 12; 
     270        TmpQWord1 |= (pB1[0] & HEX_0x000FFF0000000000) >> 12; 
     271        TmpQWord1 |= (pB1[0] & HEX_0xFFF0000000000000) >> 36; 
     272 
     273        __int64 TmpQWord2 = (pB2[0] & HEX_0x000000000000FFFF); 
     274        TmpQWord2 |= (pB2[0] & HEX_0x000000000FFF0000) << 36; 
     275        TmpQWord2 |= (pB2[0] & HEX_0x000000FFF0000000) << 12; 
     276        TmpQWord2 |= (pB2[0] & HEX_0x000FFF0000000000) >> 12; 
     277        TmpQWord2 |= (pB2[0] & HEX_0xFFF0000000000000) >> 36; 
    258278 
    259279        pB1[0] = TmpQWord2;