diff options
Diffstat (limited to 'zap/include/zap/mth.h')
-rw-r--r-- | zap/include/zap/mth.h | 125 |
1 files changed, 0 insertions, 125 deletions
diff --git a/zap/include/zap/mth.h b/zap/include/zap/mth.h deleted file mode 100644 index 00f90c9..0000000 --- a/zap/include/zap/mth.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - Copyright 2022 Gabriel Jensen. - This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. - If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. -*/ - -#if !defined(zap_priv_hdr_mth) -#define zap_priv_hdr_mth - -#include <zap/bs.h> - -#if defined(__cplusplus) -extern "C" { -#endif - -#define zap_minval_c ((char )-0x80) -#define zap_minval_i ((int )-0x80000000) -#define zap_minval_l ((long )-0x8000000000000000) -#define zap_minval_ll ((long long )-0x8000000000000000) -#define zap_minval_s ((short )-0x8000) -#define zap_minval_sc ((signed char )-0x80) - -#define zap_maxval_sc ((char )+0x7F) -#define zap_maxval_c ((int )+0x7FFFFFFF) -#define zap_maxval_i ((int )+0x7FFFFFFF) -#define zap_maxval_l ((long )+0x7FFFFFFFFFFFFFFF) -#define zap_maxval_ll ((long long )+0x7FFFFFFFFFFFFFFF) -#define zap_maxval_s ((short )+0x7FFF) -#define zap_maxval_sc ((signed char )+0x7F) -#define zap_maxval_uc ((unsigned char )+0xFFu) -#define zap_maxval_ui ((unsigned int )+0xFFFFFFFFu) -#define zap_maxval_ul ((unsigned long )+0xFFFFFFFFFFFFFFFFu) -#define zap_maxval_ull ((unsigned long long)+0xFFFFFFFFFFFFFFFFu) -#define zap_maxval_us ((unsigned short )+0xFFFFu) - -typedef struct {char div;char mod;} zap_divmod_c; -typedef struct {int div;int mod;} zap_divmod_i; -typedef struct {long div;long mod;} zap_divmod_l; -typedef struct {long long div;long long mod;} zap_divmod_ll; -typedef struct {short div;short mod;} zap_divmod_s; -typedef struct {signed char div;signed char mod;} zap_divmod_sc; -typedef struct {unsigned char div;unsigned char mod;} zap_divmod_uc; -typedef struct {unsigned int div;unsigned int mod;} zap_divmod_ui; -typedef struct {unsigned long div;unsigned long mod;} zap_divmod_ul; -typedef struct {unsigned long long div;unsigned long long mod;} zap_divmod_ull; -typedef struct {unsigned short div;unsigned short mod;} zap_divmod_us; - -typedef struct {char num;char den;} zap_frac_c; -typedef struct {int num;int den;} zap_frac_i; -typedef struct {long num;long den;} zap_frac_l; -typedef struct {long long num;long long den;} zap_frac_ll; -typedef struct {short num;short den;} zap_frac_s; -typedef struct {signed char num;signed char den;} zap_frac_sc; -typedef struct {unsigned char num;unsigned char den;} zap_frac_uc; -typedef struct {unsigned int num;unsigned int den;} zap_frac_ui; -typedef struct {unsigned long num;unsigned long den;} zap_frac_ul; -typedef struct {unsigned long long num;unsigned long long den;} zap_frac_ull; -typedef struct {unsigned short num;unsigned short den;} zap_frac_us; - -__attribute__ ((const,hot,nothrow,warn_unused_result)) unsigned char zap_abs_c( char val); -__attribute__ ((const,hot,nothrow,warn_unused_result)) unsigned int zap_abs_i( int val); -__attribute__ ((const,hot,nothrow,warn_unused_result)) unsigned long zap_abs_l( long val); -__attribute__ ((const,hot,nothrow,warn_unused_result)) unsigned long long zap_abs_ll(long long val); -__attribute__ ((const,hot,nothrow,warn_unused_result)) unsigned short zap_abs_s( short val); -__attribute__ ((const,hot,nothrow,warn_unused_result)) unsigned char zap_abs_sc(signed char val); - -__attribute__ ((const,hot,nothrow,warn_unused_result)) zap_divmod_c zap_div_c( char num,char den); -__attribute__ ((const,hot,nothrow,warn_unused_result)) zap_divmod_i zap_div_i( int num,int den); -__attribute__ ((const,hot,nothrow,warn_unused_result)) zap_divmod_l zap_div_l( long num,long den); -__attribute__ ((const,hot,nothrow,warn_unused_result)) zap_divmod_ll zap_div_ll( long long num,long long den); -__attribute__ ((const,hot,nothrow,warn_unused_result)) zap_divmod_s zap_div_s( short num,short den); -__attribute__ ((const,hot,nothrow,warn_unused_result)) zap_divmod_sc zap_div_sc( signed char num,signed char den); -__attribute__ ((const,hot,nothrow,warn_unused_result)) zap_divmod_uc zap_div_uc( unsigned char num,unsigned char den); -__attribute__ ((const,hot,nothrow,warn_unused_result)) zap_divmod_ui zap_div_ui( unsigned int num,unsigned int den); -__attribute__ ((const,hot,nothrow,warn_unused_result)) zap_divmod_ul zap_div_ul( unsigned long num,unsigned long den); -__attribute__ ((const,hot,nothrow,warn_unused_result)) zap_divmod_ull zap_div_ull(unsigned long long num,unsigned long long den); -__attribute__ ((const,hot,nothrow,warn_unused_result)) zap_divmod_us zap_div_us( unsigned short num,unsigned short den); - -__attribute__ ((const,hot,nothrow,warn_unused_result)) char zap_exp_c( char bs,unsigned char exp); -__attribute__ ((const,hot,nothrow,warn_unused_result)) int zap_exp_i( int bs,unsigned int exp); -__attribute__ ((const,hot,nothrow,warn_unused_result)) long zap_exp_l( long bs,unsigned long exp); -__attribute__ ((const,hot,nothrow,warn_unused_result)) long long zap_exp_ll( long long bs,unsigned long long exp); -__attribute__ ((const,hot,nothrow,warn_unused_result)) short zap_exp_s( short bs,unsigned short exp); -__attribute__ ((const,hot,nothrow,warn_unused_result)) signed char zap_exp_sc( signed char bs,unsigned char exp); -__attribute__ ((const,hot,nothrow,warn_unused_result)) unsigned char zap_exp_uc( unsigned char bs,unsigned char exp); -__attribute__ ((const,hot,nothrow,warn_unused_result)) unsigned int zap_exp_ui( unsigned int bs,unsigned int exp); -__attribute__ ((const,hot,nothrow,warn_unused_result)) unsigned long zap_exp_ul( unsigned long bs,unsigned long exp); -__attribute__ ((const,hot,nothrow,warn_unused_result)) unsigned long long zap_exp_ull(unsigned long long bs,unsigned long long exp); -__attribute__ ((const,hot,nothrow,warn_unused_result)) unsigned short zap_exp_us( unsigned short bs,unsigned short exp); - -__attribute__ ((const,hot,nothrow,warn_unused_result)) unsigned char zap_log_uc( unsigned char bs,unsigned char pow); -__attribute__ ((const,hot,nothrow,warn_unused_result)) unsigned int zap_log_ui( unsigned int bs,unsigned int pow); -__attribute__ ((const,hot,nothrow,warn_unused_result)) unsigned long zap_log_ul( unsigned long bs,unsigned long pow); -__attribute__ ((const,hot,nothrow,warn_unused_result)) unsigned long long zap_log_ull(unsigned long long bs,unsigned long long pow); -__attribute__ ((const,hot,nothrow,warn_unused_result)) unsigned short zap_log_us( unsigned short bs,unsigned short pow); - -__attribute__ ((const,hot,nothrow,warn_unused_result)) char zap_mul_c( char lfac,char rfac); -__attribute__ ((const,hot,nothrow,warn_unused_result)) int zap_mul_i( int lfac,int rfac); -__attribute__ ((const,hot,nothrow,warn_unused_result)) long zap_mul_l( long lfac,long rfac); -__attribute__ ((const,hot,nothrow,warn_unused_result)) long long zap_mul_ll( long long lfac,long long rfac); -__attribute__ ((const,hot,nothrow,warn_unused_result)) short zap_mul_s( short lfac,short rfac); -__attribute__ ((const,hot,nothrow,warn_unused_result)) signed char zap_mul_sc( signed char lfac,signed char rfac); -__attribute__ ((const,hot,nothrow,warn_unused_result)) unsigned char zap_mul_uc( unsigned char lfac,unsigned char rfac); -__attribute__ ((const,hot,nothrow,warn_unused_result)) unsigned int zap_mul_ui( unsigned int lfac,unsigned int rfac); -__attribute__ ((const,hot,nothrow,warn_unused_result)) unsigned long zap_mul_ul( unsigned long lfac,unsigned long rfac); -__attribute__ ((const,hot,nothrow,warn_unused_result)) unsigned long long zap_mul_ull(unsigned long long lfac,unsigned long long rfac); -__attribute__ ((const,hot,nothrow,warn_unused_result)) unsigned short zap_mul_us( unsigned short lfac,unsigned short rfac); - -__attribute__ ((const,hot,nothrow,warn_unused_result)) char zap_nrt_c( char deg,char rad); -__attribute__ ((const,hot,nothrow,warn_unused_result)) int zap_nrt_i( int deg,int rad); -__attribute__ ((const,hot,nothrow,warn_unused_result)) long zap_nrt_l( long deg,long rad); -__attribute__ ((const,hot,nothrow,warn_unused_result)) long long zap_nrt_ll( long long deg,long long rad); -__attribute__ ((const,hot,nothrow,warn_unused_result)) short zap_nrt_s( short deg,short rad); -__attribute__ ((const,hot,nothrow,warn_unused_result)) signed char zap_nrt_sc( signed char deg,signed char rad); -__attribute__ ((const,hot,nothrow,warn_unused_result)) unsigned char zap_nrt_uc( unsigned char deg,unsigned char rad); -__attribute__ ((const,hot,nothrow,warn_unused_result)) unsigned int zap_nrt_ui( unsigned int deg,unsigned int rad); -__attribute__ ((const,hot,nothrow,warn_unused_result)) unsigned long zap_nrt_ul( unsigned long deg,unsigned long rad); -__attribute__ ((const,hot,nothrow,warn_unused_result)) unsigned long long zap_nrt_ull(unsigned long long deg,unsigned long long rad); -__attribute__ ((const,hot,nothrow,warn_unused_result)) unsigned short zap_nrt_us( unsigned short deg,unsigned short rad); - -#if defined(__cplusplus) -} -#endif - -#endif |