#pragma once
#include <assert.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#ifdef _MSC_VER
#include <intrin.h>
#include <stdlib.h>
#endif
#include "xnnpack/common.h"
#ifdef min
#undef min
#endif
#ifdef max
#undef max
#endif
XNN_INLINE static size_t min(size_t a, size_t b) { … }
XNN_INLINE static size_t max(size_t a, size_t b) { … }
XNN_INLINE static size_t doz(size_t a, size_t b) { … }
XNN_INLINE static size_t divide_round_up(size_t n, size_t q) { … }
XNN_INLINE static size_t round_up(size_t n, size_t q) { … }
XNN_INLINE static bool is_po2(size_t n) { … }
XNN_INLINE static size_t round_down_po2(size_t n, size_t q) { … }
XNN_INLINE static size_t round_up_po2(size_t n, size_t q) { … }
XNN_INLINE static size_t mod_po2(size_t n, size_t m) { … }
XNN_INLINE static size_t subtract_modulo(size_t a, size_t b, size_t m) { … }
XNN_INLINE static float uint32_as_float(uint32_t i) { … }
XNN_INLINE static uint32_t float_as_uint32(float f) { … }
XNN_INLINE static double uint64_as_double(uint64_t i) { … }
XNN_INLINE static uint64_t double_as_uint64(double f) { … }
XNN_INLINE static uint32_t math_abs_s32(int32_t n) { … }
XNN_INLINE static int16_t math_signcomplement_f16(uint16_t a) { … }
XNN_INLINE static int16_t math_min_s16(int16_t a, int16_t b) { … }
XNN_INLINE static int16_t math_max_s16(int16_t a, int16_t b) { … }
XNN_INLINE static int32_t math_min_s32(int32_t a, int32_t b) { … }
XNN_INLINE static int32_t math_max_s32(int32_t a, int32_t b) { … }
XNN_INLINE static uint32_t math_min_u32(uint32_t a, uint32_t b) { … }
XNN_INLINE static uint32_t math_max_u32(uint32_t a, uint32_t b) { … }
XNN_INLINE static uint32_t math_doz_u32(uint32_t a, uint32_t b) { … }
XNN_INLINE static int64_t math_mulext_s32(int32_t a, int32_t b) { … }
XNN_INLINE static uint64_t math_mulext_u32(uint32_t a, uint32_t b) { … }
XNN_INLINE static float math_muladd_f32(float x, float y, float acc) { … }
XNN_INLINE static float math_pmin_f32(float a, float b) { … }
XNN_INLINE static float math_pmax_f32(float a, float b) { … }
XNN_INLINE static double math_pmin_f64(double a, double b) { … }
XNN_INLINE static double math_pmax_f64(double a, double b) { … }
XNN_INLINE static float math_min_f32(float a, float b) { … }
XNN_INLINE static float math_max_f32(float a, float b) { … }
XNN_INLINE static double math_min_f64(double a, double b) { … }
XNN_INLINE static double math_max_f64(double a, double b) { … }
XNN_INLINE static float math_nonsign_mask_f32() { … }
#if defined(__clang__)
#if __clang_major__ == 3 && __clang_minor__ >= 7 || __clang_major__ > 3
#define XNN_IGNORE_SHIFT_BASE_UB …
#else
#define XNN_IGNORE_SHIFT_BASE_UB
#endif
#elif defined(__GNUC__)
#if __GNUC__ >= 8
#define XNN_IGNORE_SHIFT_BASE_UB …
#elif __GNUC__ == 4 && __GNUC_MINOR__ >= 9 || __GNUC__ > 4
#define XNN_IGNORE_SHIFT_BASE_UB
#ifndef XNN_USE_SHIFT_BASE_UB_WORKAROUND
#define XNN_USE_SHIFT_BASE_UB_WORKAROUND …
#endif
#else
#define XNN_IGNORE_SHIFT_BASE_UB
#endif
#else
#define XNN_IGNORE_SHIFT_BASE_UB
#endif
XNN_IGNORE_SHIFT_BASE_UB
XNN_INLINE static int32_t math_asr_s32(int32_t x, uint32_t n) { … }
XNN_IGNORE_SHIFT_BASE_UB
XNN_INLINE static int64_t math_asr_s64(int64_t x, uint32_t n) { … }
XNN_INLINE static uint32_t math_clz_u32(uint32_t x) { … }
XNN_INLINE static uint32_t math_clz_nonzero_u32(uint32_t x) { … }
XNN_INLINE static uint32_t math_ctz_u32(uint32_t x) { … }
XNN_INLINE static uint32_t math_rotl_u32(uint32_t x, int8_t r)
{ … }
#ifndef __cplusplus
XNN_INLINE static uint32_t math_cvt_sat_u32_f64(double x) { … }
#endif
XNN_INLINE static float math_cvt_fp32_bf16(uint16_t x) { … }
XNN_INLINE static float math_cvt_bf16_fp32(float x) { … }