physfs_byteorder.c
changeset 194 09c353d30cd4
parent 177 9aaf01f4b8ec
child 201 7ea2ae5d1a6c
equal deleted inserted replaced
193:830c165052a5 194:09c353d30cd4
    39 #ifdef __arch__swab32
    39 #ifdef __arch__swab32
    40 #define PHYSFS_Swap32  __arch__swab32
    40 #define PHYSFS_Swap32  __arch__swab32
    41 #endif
    41 #endif
    42 #endif /* linux */
    42 #endif /* linux */
    43 
    43 
       
    44 #if (defined _MSC_VER)
       
    45 #define inline __inline
       
    46 #endif
       
    47 
    44 #ifndef PHYSFS_Swap16
    48 #ifndef PHYSFS_Swap16
    45 static __inline__ PHYSFS_uint16 PHYSFS_Swap16(PHYSFS_uint16 D)
    49 static inline PHYSFS_uint16 PHYSFS_Swap16(PHYSFS_uint16 D)
    46 {
    50 {
    47 	return((D<<8)|(D>>8));
    51 	return((D<<8)|(D>>8));
    48 }
    52 }
    49 #endif
    53 #endif
    50 #ifndef PHYSFS_Swap32
    54 #ifndef PHYSFS_Swap32
    51 static __inline__ PHYSFS_uint32 PHYSFS_Swap32(PHYSFS_uint32 D)
    55 static inline PHYSFS_uint32 PHYSFS_Swap32(PHYSFS_uint32 D)
    52 {
    56 {
    53 	return((D<<24)|((D<<8)&0x00FF0000)|((D>>8)&0x0000FF00)|(D>>24));
    57 	return((D<<24)|((D<<8)&0x00FF0000)|((D>>8)&0x0000FF00)|(D>>24));
    54 }
    58 }
    55 #endif
    59 #endif
    56 #ifndef PHYSFS_NO_64BIT_SUPPORT
    60 #ifndef PHYSFS_NO_64BIT_SUPPORT
    57 #ifndef PHYSFS_Swap64
    61 #ifndef PHYSFS_Swap64
    58 static __inline__ PHYSFS_uint64 PHYSFS_Swap64(PHYSFS_uint64 val) {
    62 static inline PHYSFS_uint64 PHYSFS_Swap64(PHYSFS_uint64 val) {
    59 	PHYSFS_uint32 hi, lo;
    63 	PHYSFS_uint32 hi, lo;
    60 
    64 
    61 	/* Separate into high and low 32-bit values and swap them */
    65 	/* Separate into high and low 32-bit values and swap them */
    62 	lo = (PHYSFS_uint32)(val&0xFFFFFFFF);
    66 	lo = (PHYSFS_uint32)(val&0xFFFFFFFF);
    63 	val >>= 32;
    67 	val >>= 32;