Go to the documentation of this file.
30# define BM_ASSERT _ASSERT
32# ifdef HAVE_RESTRICT_CXX
33# define BM_HASRESTRICT
34# define BMRESTRICT NCBI_RESTRICT
37# if defined(NCBI_FORCEINLINE) && \
38 ( !defined(NCBI_COMPILER_GCC) || NCBI_COMPILER_VERSION >= 400 || \
39 defined(__OPTIMIZE__))
40# define BM_HASFORCEINLINE
41# define BMFORCEINLINE NCBI_FORCEINLINE
60#if defined(__i386) || defined(__x86_64) || defined(__ppc__) || \
61 defined(__ppc64__) || defined(_M_IX86) || defined(_M_AMD64) || \
62 defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64) || \
63 defined(_M_ARM) || defined(_M_ARM64) || \
64 defined(__arm__) || defined(__aarch64__) || \
65 (defined(_M_MPPC) && !defined(BM_FORBID_UNALIGNED_ACCESS))
66#define BM_UNALIGNED_ACCESS_OK 1
69#if defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64) || \
70 defined(__i386) || defined(__x86_64) || defined(_M_AMD64) || \
71 defined(BMSSE2OPT) || defined(BMSSE42OPT)
77#if defined(BM_NO_CXX11) || (defined(_MSC_VER) && _MSC_VER < 1900)
82# define BMNOEXCEPT noexcept
83#if defined(__EMSCRIPTEN__)
92#if defined(__EMSCRIPTEN__)
104# define BM_USE_GCC_BUILD
105# define BMNOEXCEPT2 noexcept
115# define BM_HASFORCEINLINE
117# define BMRESTRICT __restrict
123# define BMRESTRICT __restrict__
139# define BM_ASSERT assert
148#if defined(__x86_64) || defined(_M_AMD64) || defined(_WIN64) || \
149 defined(__LP64__) || defined(_LP64) || ( __WORDSIZE == 64 )
157#define FULL_BLOCK_REAL_ADDR bm::all_set<true>::_block._p
158#define FULL_BLOCK_FAKE_ADDR bm::all_set<true>::_block._p_fullp
159#define FULL_SUB_BLOCK_REAL_ADDR bm::all_set<true>::_block._s
160#define BLOCK_ADDR_SAN(addr) (addr == FULL_BLOCK_FAKE_ADDR) ? FULL_BLOCK_REAL_ADDR : addr
161#define IS_VALID_ADDR(addr) bm::all_set<true>::is_valid_block_addr(addr)
162#define IS_FULL_BLOCK(addr) bm::all_set<true>::is_full_block(addr)
163#define IS_EMPTY_BLOCK(addr) bool(addr == 0)
165#define BM_BLOCK_TYPE(addr) bm::all_set<true>::block_type(addr)
175# if ULONG_MAX != 0xffffffff || defined(_WIN64)
177# define BMPTR_SETBIT0(ptr) ( ((bm::id64_t)ptr) | 1 )
178# define BMPTR_CLEARBIT0(ptr) ( ((bm::id64_t)ptr) & ~(bm::id64_t)1 )
179# define BMPTR_TESTBIT0(ptr) ( ((bm::id64_t)ptr) & 1 )
183# define BMPTR_SETBIT0(ptr) ( ((bm::id_t)ptr) | 1 )
184# define BMPTR_CLEARBIT0(ptr) ( ((bm::id_t)ptr) & ~(bm::id_t)1 )
185# define BMPTR_TESTBIT0(ptr) ( ((bm::id_t)ptr) & 1 )
189# define BMGAP_PTR(ptr) ((bm::gap_word_t*)BMPTR_CLEARBIT0(ptr))
190# define BMSET_PTRGAP(ptr) ptr = (bm::word_t*)BMPTR_SETBIT0(ptr)
191# define BM_IS_GAP(ptr) (BMPTR_TESTBIT0(ptr))
199# define BMRESTRICT restrict
208#ifdef BM_HASFORCEINLINE
209# ifndef BMFORCEINLINE
210# define BMFORCEINLINE __forceinline
213# define BMFORCEINLINE inline
223# if defined(BM64OPT) || defined(__x86_64) || defined(_M_AMD64) || defined(_WIN64) || \
224 defined(__LP64__) || defined(_LP64) || ( __WORDSIZE == 64 )
232# if defined(BM64OPT) || defined(__x86_64) || defined(_M_AMD64) || defined(_WIN64) || \
233 defined(__LP64__) || defined(_LP64)
243# if defined(BM64OPT) || defined(__x86_64) || defined(_M_AMD64) || defined(_WIN64) || \
244 defined(__LP64__) || defined(_LP64)
256# ifndef BM_SET_MMX_GUARD
257# define BM_SET_MMX_GUARD
261#if (defined(BMSSE2OPT) || defined(BMSSE42OPT) || defined(BMAVX2OPT) || defined(BMAVX512OPT))
263 # ifndef BM_SET_MMX_GUARD
264 # define BM_SET_MMX_GUARD sse_empty_guard bm_mmx_guard_;
270 # define BM_ALIGN16 __declspec(align(16))
271 # define BM_ALIGN16ATTR
275 # define BM_ALIGN32 __declspec(align(32))
276 # define BM_ALIGN32ATTR
280 # define BM_ALIGN64 __declspec(align(64))
281 # define BM_ALIGN64ATTR
288 # define BM_ALIGN16ATTR __attribute__((aligned(16)))
293 # define BM_ALIGN32ATTR __attribute__((aligned(32)))
298 # define BM_ALIGN64ATTR __attribute__((aligned(64)))
305 #define BM_ALIGN16ATTR
307 #define BM_ALIGN32ATTR
309 #define BM_ALIGN64ATTR
315#if (defined(BMSSE2OPT) || defined(BMSSE42OPT) || defined(BMWASMSIMDOPT) || defined(BMNEONOPT))
316# define BM_VECT_ALIGN BM_ALIGN16
317# define BM_VECT_ALIGN_ATTR BM_ALIGN16ATTR
319# if defined(BMAVX2OPT)
320# define BM_VECT_ALIGN BM_ALIGN32
321# define BM_VECT_ALIGN_ATTR BM_ALIGN32ATTR
323# if defined(BMAVX512OPT)
324# define BM_VECT_ALIGN BM_ALIGN64
325# define BM_VECT_ALIGN_ATTR BM_ALIGN64ATTR
327# define BM_VECT_ALIGN
328# define BM_VECT_ALIGN_ATTR
337#ifndef BM_ASSERT_THROW
338#define BM_ASSERT_THROW(x, xerrcode)
342#ifndef __has_cpp_attribute
343# define __has_cpp_attribute(x) 0
345#ifndef __has_attribute
346# define __has_attribute(x) 0
348#if __has_cpp_attribute(fallthrough) && \
349 (!defined(__clang__) || (__clang_major__ > 7 && __cplusplus >= 201703L))
350# define BM_FALLTHROUGH [[fallthrough]]
351#elif __has_cpp_attribute(gcc::fallthrough)
352# define BM_FALLTHROUGH [[gcc::fallthrough]]
353#elif __has_cpp_attribute(clang::fallthrough)
354# define BM_FALLTHROUGH [[clang::fallthrough]]
355#elif __has_attribute(fallthrough)
356# define BM_FALLTHROUGH __attribute__ ((fallthrough))
358# define BM_FALLTHROUGH