diff options
Diffstat (limited to 'platform/linux-generic/include/api/odp/compiler.h')
-rw-r--r-- | platform/linux-generic/include/api/odp/compiler.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/platform/linux-generic/include/api/odp/compiler.h b/platform/linux-generic/include/api/odp/compiler.h new file mode 100644 index 000000000..71a44317a --- /dev/null +++ b/platform/linux-generic/include/api/odp/compiler.h @@ -0,0 +1,51 @@ +/* Copyright (c) 2014, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + + +/** + * @file + * + * Compiler related + */ + +#ifndef ODP_COMPILER_H_ +#define ODP_COMPILER_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** @addtogroup odp_compiler_optim + * Macro for old compilers + * @{ + */ + +/** @internal GNU compiler version */ +#define GCC_VERSION (__GNUC__ * 10000 \ + + __GNUC_MINOR__ * 100 \ + + __GNUC_PATCHLEVEL__) + +/** + * @internal + * Compiler __builtin_bswap16() is not available on all platforms + * until GCC 4.8.0 - work around this by offering __odp_builtin_bswap16() + * Don't use this function directly, instead see odp_byteorder.h + */ +#if GCC_VERSION < 40800 +#define __odp_builtin_bswap16(u16) ((((u16)&0x00ff) << 8)|(((u16)&0xff00) >> 8)) +#else +#define __odp_builtin_bswap16(u16) __builtin_bswap16(u16) +#endif + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif |