openalbridge/endianness.h
changeset 2203 6bd39d75e0dd
parent 2200 8192be6e3aef
child 2212 6b5da1a2765a
equal deleted inserted replaced
2202:29508a2924c2 2203:6bd39d75e0dd
    26 #endif
    26 #endif
    27 
    27 
    28 #ifdef __CPLUSPLUS
    28 #ifdef __CPLUSPLUS
    29 extern "C" {
    29 extern "C" {
    30 #endif 
    30 #endif 
    31 
    31 	
       
    32 #ifdef HAVE_BYTESWAP_H
       
    33 	/* use byteswap macros from the host system, hopefully optimized ones ;-) */
       
    34 #include <byteswap.h>
       
    35 #else
       
    36 	/* define our own version, simple, stupid, straight-forward... */
       
    37 	
       
    38 #define bswap_16(x)	((((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8))
       
    39 	
       
    40 #define bswap_32(x)	((((x) & 0xFF000000) >> 24) | \
       
    41 					(((x) & 0x00FF0000) >> 8)  | \
       
    42 					(((x) & 0x0000FF00) << 8)  | \
       
    43 					(((x) & 0x000000FF) << 24) )
       
    44 	
       
    45 #endif
       
    46 	
       
    47 	
    32 #pragma once
    48 #pragma once
    33 
    49 	
    34 int invert_endianness(int number);
    50 	int invert_endianness(int number);
    35 
    51 	
    36 #ifdef __CPLUSPLUS
    52 #ifdef __CPLUSPLUS
    37 }
    53 }
    38 #endif
    54 #endif