/* * @file hv_vos_Endian.h * @brief Header file of endian. * * @verbatim * ============================================================================== * ##### How to use ##### * ============================================================================== * (+) Use () * * @endverbatim * @author HiView SoC Software Team * @version 1.0.0 * @date 2023-03-01 */ /** @file vos_endian.h * @brief VOS endian functions */ #ifndef _HV_VOS_ENDIAN_H #define _HV_VOS_ENDIAN_H #include "hv_vos_Types.h" VOS_EXTERN_C_BEGIN /** @defgroup VOS_ENDIAN VOS_ENDIAN * VOS endian related routines * @{ */ #ifndef HV_SWAP32 #define HV_SWAP32(x) \ ( \ (((x) >> 24) & 0xFF ) | \ (((x) >> 8) & 0xFF00) | \ (((x) & 0xFF00) << 8 ) | \ (((x) & 0xFF) << 24 ) \ ) #endif #ifndef HV_SWAP16 #define HV_SWAP16(x) \ ( \ (((x) & 0xFF) << 8 ) | \ (((x) & 0xFF00) >> 8 ) \ ) #endif #ifndef HV_SWAP32_INPLACE #ifdef HV_CONFIG_ENDIAN_LITTLE #define HV_SWAP32_INPLACE(addr) HV_W32((addr), HV_SWAP32(HV_R32(addr))) #else #define HV_SWAP32_INPLACE(addr) HV_W32_BE((addr), HV_SWAP32(HV_R32_BE(addr))) #endif #endif /** @} */ VOS_EXTERN_C_END #endif