22 lines
501 B
C
22 lines
501 B
C
//
|
|
// Created by rick on 14-5-22.
|
|
//
|
|
|
|
#ifndef NEW_KERNEL_ENDIAN_H
|
|
#define NEW_KERNEL_ENDIAN_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
|
#define leu16_to_native(x) x
|
|
#define leu32_to_native(x) x
|
|
#else
|
|
#define leu16_to_native(x) ((x) >> 8 | (x) << 8)
|
|
#define leu32_to_native(x) (((x)>>24)&0xff) | \
|
|
(((x)<<8)&0xff0000) | \
|
|
(((x)>>8)&0xff00) | \
|
|
(((x)<<24)&0xff000000)
|
|
#endif
|
|
|
|
#endif //NEW_KERNEL_ENDIAN_H
|