bdk: types: add likely/unlikely global macros

This commit is contained in:
CTCaer 2024-04-25 04:48:09 +03:00
parent 28960728f9
commit 62153fdfbb
2 changed files with 2 additions and 10 deletions

View file

@ -92,16 +92,6 @@
# define LZ4_FORCE_O2_INLINE_GCC_PPC64LE static # define LZ4_FORCE_O2_INLINE_GCC_PPC64LE static
#endif #endif
#if (defined(__GNUC__) && (__GNUC__ >= 3)) || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800)) || defined(__clang__)
# define expect(expr,value) (__builtin_expect ((expr),(value)) )
#else
# define expect(expr,value) (expr)
#endif
#define likely(expr) expect((expr) != 0, 1)
#define unlikely(expr) expect((expr) != 0, 0)
/*-************************************ /*-************************************
* Memory routines * Memory routines
**************************************/ **************************************/

View file

@ -102,6 +102,8 @@ typedef unsigned long uptr;
#define byte_swap_32(num) ((((num) >> 24) & 0xff) | (((num) << 8) & 0xff0000) | \ #define byte_swap_32(num) ((((num) >> 24) & 0xff) | (((num) << 8) & 0xff0000) | \
(((num) >> 8 ) & 0xff00) | (((num) << 24) & 0xff000000)) (((num) >> 8 ) & 0xff00) | (((num) << 24) & 0xff000000))
#define likely(x) (__builtin_expect((x) != 0, 1))
#define unlikely(x) (__builtin_expect((x) != 0, 0))
/* Bootloader/Nyx */ /* Bootloader/Nyx */
#define BOOT_CFG_AUTOBOOT_EN BIT(0) #define BOOT_CFG_AUTOBOOT_EN BIT(0)