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