#ifndef __BASE_H
#define __BASE_H
#ifndef __has_extension
#define __has_extension(x) 0
#endif
#if __has_extension(c_static_assert)
#define MALLOC_STATIC_ASSERT(x, y) _Static_assert((x), y)
#else
#define MALLOC_STATIC_ASSERT(x, y)
#endif
#define MALLOC_ASSERT(e) ({ \
if (__builtin_expect(!(e), 0)) { \
__asm__ __volatile__ (""); \
__builtin_trap(); \
} \
})
#define MALLOC_FATAL_ERROR(cause, message) ({ \
_os_set_crash_log_cause_and_message((cause), "FATAL ERROR - " message); \
__asm__ __volatile__ (""); \
__builtin_trap(); \
})
#define MALLOC_PRINTF_FATAL_ERROR(cause, message) ({ \
malloc_printf("*** FATAL ERROR - " message ".\n"); \
MALLOC_FATAL_ERROR((cause), message); \
})
#if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || defined(__arm64__)
# define __APPLE_API_PRIVATE
# include <machine/cpu_capabilities.h>
# if defined(__i386__) || defined(__x86_64__)
# define _COMM_PAGE_VERSION_REQD 9
# else
# define _COMM_PAGE_VERSION_REQD 3
# endif
# undef __APPLE_API_PRIVATE
#else
# include <sys/sysctl.h>
#endif
#if defined(__i386__) || defined(__x86_64__)
# define MALLOC_CACHE_LINE 128
# define MALLOC_NANO_CACHE_LINE 64
#elif defined(__arm__) || defined(__arm64__)
# define MALLOC_CACHE_LINE 64
# define MALLOC_NANO_CACHE_LINE 64
#else
# define MALLOC_CACHE_LINE 32
# define MALLOC_NANO_CACHE_LINE 32
#endif
#define MALLOC_CACHE_ALIGN __attribute__ ((aligned (MALLOC_CACHE_LINE) ))
#define MALLOC_NANO_CACHE_ALIGN __attribute__ ((aligned (MALLOC_NANO_CACHE_LINE) ))
#define MALLOC_EXPORT extern __attribute__((visibility("default")))
#define MALLOC_NOEXPORT __attribute__((visibility("hidden")))
#define MALLOC_NOINLINE __attribute__((noinline))
#define MALLOC_INLINE __inline__
#define MALLOC_ALWAYS_INLINE __attribute__((always_inline))
#define MALLOC_PACKED __attribute__((packed))
#define MALLOC_USED __attribute__((used))
#define MALLOC_UNUSED __attribute__((unused))
#define CHECK_MAGAZINE_PTR_LOCKED(szone, mag_ptr, fun) {}
#define SCRIBBLE_BYTE 0xaa
#define SCRABBLE_BYTE 0x55
#define SCRUBBLE_BYTE 0xdd
#define NDEBUG 1
#define trunc_page_quanta(x) trunc_page((x))
#define round_page_quanta(x) round_page((x))
#define vm_page_quanta_size (vm_page_size)
#define vm_page_quanta_shift (vm_page_shift)
#define MALLOC_ADD_GUARD_PAGES (1 << 0)
#define MALLOC_DONT_PROTECT_PRELUDE (1 << 1)
#define MALLOC_DONT_PROTECT_POSTLUDE (1 << 2)
#define MALLOC_DO_SCRIBBLE (1 << 3)
#define MALLOC_ABORT_ON_ERROR (1 << 4)
#define MALLOC_PURGEABLE (1 << 5)
#define MALLOC_ABORT_ON_CORRUPTION (1 << 6)
#define MALLOC_EXTENDED_SMALL_SLOTS (1 << 7)
typedef unsigned short msize_t;
typedef unsigned int grain_t; typedef struct large_entry_s large_entry_t;
typedef struct szone_s szone_t;
typedef struct rack_s rack_t;
typedef struct magazine_s magazine_t;
typedef int mag_index_t;
typedef void *region_t;
#endif // __BASE_H