diff options
-rw-r--r-- | CHANGELOG.txt | 11 | ||||
-rw-r--r-- | test.cc | 127 | ||||
-rw-r--r-- | zp/include-private/zp/imp/prv.ii | 6 | ||||
-rw-r--r-- | zp/include/zp/imp/str.ii | 6 | ||||
-rw-r--r-- | zp/include/zp/imp/zp.ii | 31 | ||||
-rw-r--r-- | zp/include/zp/mth | 270 | ||||
-rw-r--r-- | zp/include/zp/mth.h | 298 | ||||
-rw-r--r-- | zp/include/zp/prv/chr.h | 12 | ||||
-rw-r--r-- | zp/include/zp/prv/flt.h | 104 | ||||
-rw-r--r-- | zp/include/zp/prv/int.h | 75 | ||||
-rw-r--r-- | zp/include/zp/str | 6 | ||||
-rw-r--r-- | zp/include/zp/str.h | 40 | ||||
-rw-r--r-- | zp/include/zp/zp | 91 | ||||
-rw-r--r-- | zp/include/zp/zp.h | 6 | ||||
-rw-r--r-- | zp/source/any/str/fmt.cc | 20 | ||||
-rw-r--r-- | zp/source/any/str/fmtlen.cc | 20 |
16 files changed, 431 insertions, 692 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 6e4ee6e..dc9a084 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -170,6 +170,17 @@ * Fix trtval; +* Add optional type: opt; +* Remove minimum-width integral types; +* Guarantee fixed-width integral types; +* Guarantee fixed-width floating-point types; +* Remove extended fixed-width integral types; +* Remove extended fixed-width floating-point types (including f01); +* Only overload mathematical functions for fixed-width types; +* Move inf and nan to zp; +* Fix urch not being renamed to unrch in C++; +* Remove constant mathematical functions; + # 0.0.2 * Migrate to CMake; @@ -34,14 +34,14 @@ static_assert(::zp::isptr<int const volatile * const volatile>::val == true); static_assert(::zp::typequ<int,int>::val == true); static_assert(::zp::typequ<int,long>::val == false); -static_assert(::zp::typequ<::zp::i8m, ::std::uint_least8_t>::val == true); -static_assert(::zp::typequ<::zp::i8ms, ::std::int_least8_t>::val == true); -static_assert(::zp::typequ<::zp::i01m, ::std::uint_least16_t>::val == true); -static_assert(::zp::typequ<::zp::i01ms,::std::int_least16_t>::val == true); -static_assert(::zp::typequ<::zp::i02m, ::std::uint_least32_t>::val == true); -static_assert(::zp::typequ<::zp::i02ms,::std::int_least32_t>::val == true); -static_assert(::zp::typequ<::zp::i04m, ::std::uint_least64_t>::val == true); -static_assert(::zp::typequ<::zp::i04ms,::std::int_least64_t>::val == true); +static_assert(::zp::typequ<::zp::i8, ::std::uint_least8_t>::val == true); +static_assert(::zp::typequ<::zp::i8s, ::std::int_least8_t>::val == true); +static_assert(::zp::typequ<::zp::i01, ::std::uint_least16_t>::val == true); +static_assert(::zp::typequ<::zp::i01s,::std::int_least16_t>::val == true); +static_assert(::zp::typequ<::zp::i02, ::std::uint_least32_t>::val == true); +static_assert(::zp::typequ<::zp::i02s,::std::int_least32_t>::val == true); +static_assert(::zp::typequ<::zp::i04, ::std::uint_least64_t>::val == true); +static_assert(::zp::typequ<::zp::i04s,::std::int_least64_t>::val == true); static_assert(::zp::typequ<::zp::intptr,::std::uintptr_t>::val == true); static_assert(::zp::typequ<::zp::siz, ::std::size_t>::val == true); @@ -157,14 +157,14 @@ static_assert(::zp::maxval<long unsigned>::val == ::std::numeric_limits<lon static_assert(::zp::maxval<long long unsigned>::val == ::std::numeric_limits<long long unsigned>::max()); static_assert(::zp::maxval<wchar_t>::val == ::std::numeric_limits<wchar_t>::max()); -template<typename ltyp,typename rtyp> static auto cmp(int unsigned & num,int unsigned & numerr,long const ln,ltyp const & lvalref,rtyp const & rvalref) noexcept { +template<typename ltyp,typename rtyp> static auto cmp_eq(int unsigned & num,int unsigned & numerr,long const ln,ltyp const & lvalref,rtyp const & rvalref) noexcept { char const * const ltypnm = typeid (ltyp).name(); char const * const rtypnm = typeid (rtyp).name(); auto const getval = [](auto const & valref) { using typ = typename ::zp::remref<decltype (valref)>::typ; - if constexpr (::zp::ischrtyp<typ>::val) {return static_cast<::zp::i02m>(valref);} + if constexpr (::zp::ischrtyp<typ>::val) {return static_cast<::zp::i02>(valref);} else if constexpr (::zp::isptr<typ>::val) {return reinterpret_cast<void *>(valref);} else {return valref;} }; @@ -185,14 +185,14 @@ template<typename ltyp,typename rtyp> static auto cmp(int unsigned & num,int uns ::std::cout <<"\x1B[38;5;77mequal\x1B[0m\n"; } -#define cmp(lval,rval) (::cmp(num,numerr,__LINE__,(lval),(rval))) +#define cmp_eq(lval,rval) (::cmp_eq(num,numerr,__LINE__,(lval),(rval))) int main() { int unsigned num; int unsigned numerr = 0x0u; - auto const tst = [&num](char const * const cmp) noexcept { - ::std::cout <<"\n\x1B[38;5;75mtesting\x1B[0m " <<cmp <<"\n\n"; + auto const tst = [&num](char const * const cmp_eq) noexcept { + ::std::cout <<"\n\x1B[38;5;75mtesting\x1B[0m " <<cmp_eq <<"\n\n"; num = 0x0; }; @@ -200,6 +200,25 @@ int main() { ::std::cout <<"zp " <<::zp::ver.api <<"." <<::zp::ver.ext <<", run-time test\n"; try { + [&] { + tst("optionals"); + + ::zp::opt<::zp::i8s> opt = ::zp::nulopt; + + cmp_eq(opt.chk(),false); + + auto const fun = [](char const * msg) -> void { + ::std::cout << msg << ::std::endl; + + ::std::abort(); + }; + + opt = -0x45; + + cmp_eq(opt.chk(),true); + cmp_eq(opt.exp(fun,"expectation failed"),-0x45); + }(); + /*[&] { tst("vectors"); @@ -211,7 +230,7 @@ int main() { .x = +0x2, .y = -0x4, }; - cmp(::zp::dot(lvec2,rvec2),0xE); + cmp_eq(::zp::dot(lvec2,rvec2),0xE); ::zp::vec3<int> const lvec3 = { .x = +0x1, @@ -223,7 +242,7 @@ int main() { .y = -0x4, .z = +0x6, }; - cmp(::zp::dot(lvec3,rvec3),0x2C); + cmp_eq(::zp::dot(lvec3,rvec3),0x2C); ::zp::vec4<int> const lvec4 = { .x = +0x1, @@ -237,22 +256,22 @@ int main() { .z = +0x6, .w = -0x8, }; - cmp(::zp::dot(lvec4,rvec4),0x64); + cmp_eq(::zp::dot(lvec4,rvec4),0x64); auto const avec2 = ::zp::vadd(lvec2,rvec2); auto const svec2 = ::zp::vsub(lvec2,rvec2); - cmp(avec2.x,+0x3); - cmp(avec2.y,-0x7); - cmp(svec2.x,-0x1); - cmp(svec2.y,+0x1); + cmp_eq(avec2.x,+0x3); + cmp_eq(avec2.y,-0x7); + cmp_eq(svec2.x,-0x1); + cmp_eq(svec2.y,+0x1); }(); [&] { tst("special numbers"); - cmp(zp_isnanf( zp_nanf), true); - cmp(zp_isnand( zp_nand), true); - cmp(zp_isnandl(zp_nanld),true); + cmp_eq(zp_isnanf( zp_nanf), true); + cmp_eq(zp_isnand( zp_nand), true); + cmp_eq(zp_isnandl(zp_nanld),true); }();*/ [&] { @@ -260,19 +279,19 @@ int main() { ::zp::i04 filbuf; - cmp(::zp::memfil(&filbuf,0xFFu,0x8u),reinterpret_cast<char unsigned *>(&filbuf)+0x8u); - cmp(::zp::memfil(&filbuf,0x7Fu,0x4u),reinterpret_cast<char unsigned *>(&filbuf)+0x4u); - cmp(::zp::memfil(&filbuf,0x3Fu,0x2u),reinterpret_cast<char unsigned *>(&filbuf)+0x2u); - cmp(::zp::memfil(&filbuf,0x1Fu,0x1u),reinterpret_cast<char unsigned *>(&filbuf)+0x1u); + cmp_eq(::zp::memfil(&filbuf,0xFFu,0x8u),reinterpret_cast<char unsigned *>(&filbuf)+0x8u); + cmp_eq(::zp::memfil(&filbuf,0x7Fu,0x4u),reinterpret_cast<char unsigned *>(&filbuf)+0x4u); + cmp_eq(::zp::memfil(&filbuf,0x3Fu,0x2u),reinterpret_cast<char unsigned *>(&filbuf)+0x2u); + cmp_eq(::zp::memfil(&filbuf,0x1Fu,0x1u),reinterpret_cast<char unsigned *>(&filbuf)+0x1u); - cmp(filbuf,0xFFFFFFFF7F7F3F1Fu); + cmp_eq(filbuf,0xFFFFFFFF7F7F3F1Fu); ::zp::i04 cpybuf; ::zp::memcpy(&cpybuf,&filbuf,0x8u); - cmp(cpybuf,filbuf); + cmp_eq(cpybuf,filbuf); - cmp(::zp::memsrh(&cpybuf,0x1Fu,0x8u),reinterpret_cast<char unsigned *>(&cpybuf)); + cmp_eq(::zp::memsrh(&cpybuf,0x1Fu,0x8u),reinterpret_cast<char unsigned *>(&cpybuf)); }(); [&] { @@ -286,17 +305,17 @@ int main() { ::zp::siz const wlen = ::zp_wstrlen( wstr); ::zp::siz const len02 = ::zp_utf32len(str02); - cmp(len, 0xCu); - cmp(wlen, 0xCu); - cmp(len02,0xCu); + cmp_eq(len, 0xCu); + cmp_eq(wlen, 0xCu); + cmp_eq(len02,0xCu); auto const buf = new char[ len]; auto const wbuf = new wchar_t[ wlen]; auto const buf02 = new char32_t[len02]; - cmp(::zp_strcpy( buf, str), len); - cmp(::zp_wstrcpy( wbuf, wstr), wlen); - cmp(::zp_utf32cpy(buf02,str02),len02); + cmp_eq(::zp_strcpy( buf, str), len); + cmp_eq(::zp_wstrcpy( wbuf, wstr), wlen); + cmp_eq(::zp_utf32cpy(buf02,str02),len02); delete[] buf; delete[] wbuf; @@ -309,27 +328,27 @@ int main() { char32_t const src[] = U"\U0001F480"; ::zp::siz const buf8len = ::zp_utf8enclen(src); - cmp(buf8len,0x4u); + cmp_eq(buf8len,0x4u); ::zp::c8 * buf8 = new ::zp::c8[buf8len+0x1]; ::zp_utf8enc(buf8,src); - cmp(buf8[0x0],0xF0u); - cmp(buf8[0x1],0x9Fu); - cmp(buf8[0x2],0x92u); - cmp(buf8[0x3],0x80u); - cmp(buf8[0x4],0x00u); + cmp_eq(buf8[0x0],0xF0u); + cmp_eq(buf8[0x1],0x9Fu); + cmp_eq(buf8[0x2],0x92u); + cmp_eq(buf8[0x3],0x80u); + cmp_eq(buf8[0x4],0x00u); ::zp::siz const buf02len = ::zp_utf8declen(buf8); - cmp(buf02len,0x1u); + cmp_eq(buf02len,0x1u); char32_t * buf02 = new char32_t[buf02len+0x1]; ::zp_utf8dec(buf02,buf8); - cmp(buf02[0x0],0x1F480u); - cmp(buf02[0x1],0x0u); + cmp_eq(buf02[0x0],0x1F480u); + cmp_eq(buf02[0x1],0x0u); delete[] buf8; delete[] buf02; @@ -341,27 +360,27 @@ int main() { char32_t const src[] = U"\U0001F480\u00F0"; ::zp::siz const buf01len = ::zp_utf16enclen(src); - cmp(buf01len,0x3u); + cmp_eq(buf01len,0x3u); char16_t * buf01 = new char16_t[buf01len+0x1]; ::zp_utf16enc(buf01,src); - cmp(buf01[0x0],0xD83Du); - cmp(buf01[0x1],0xDC80u); - cmp(buf01[0x2],0x00F0u); - cmp(buf01[0x3],0x0000u); + cmp_eq(buf01[0x0],0xD83Du); + cmp_eq(buf01[0x1],0xDC80u); + cmp_eq(buf01[0x2],0x00F0u); + cmp_eq(buf01[0x3],0x0000u); ::zp::siz const buf02len = ::zp_utf16declen(buf01); - cmp(buf02len,0x2u); + cmp_eq(buf02len,0x2u); char32_t * buf02 = new char32_t[buf02len+0x1]; ::zp_utf16dec(buf02,buf01); - cmp(buf02[0x0],0x1F480u); - cmp(buf02[0x1],0xF0u); - cmp(buf02[0x2],0x0u); + cmp_eq(buf02[0x0],0x1F480u); + cmp_eq(buf02[0x1],0xF0u); + cmp_eq(buf02[0x2],0x0u); delete[] buf01; delete[] buf02; diff --git a/zp/include-private/zp/imp/prv.ii b/zp/include-private/zp/imp/prv.ii index ae13d25..a91db49 100644 --- a/zp/include-private/zp/imp/prv.ii +++ b/zp/include-private/zp/imp/prv.ii @@ -49,10 +49,10 @@ template<typename typ> zp_nothw typ * zp::det::strsrh(typ const * str,typ const //static_assert(::zp::ischrtyp<typ>::val,"type must be a character type"); for (;;++str) { - typ const curchr = *str; + typ const cunrchr = *str; - zp_unlik (curchr == chr) {return const_cast<typ *>(str);} - zp_unlik (curchr == typ (0x0)) {break;} + zp_unlik (cunrchr == chr) {return const_cast<typ *>(str);} + zp_unlik (cunrchr == typ (0x0)) {break;} } return zp_nulptr; diff --git a/zp/include/zp/imp/str.ii b/zp/include/zp/imp/str.ii index f5e40e3..e8310b8 100644 --- a/zp/include/zp/imp/str.ii +++ b/zp/include/zp/imp/str.ii @@ -5,7 +5,7 @@ */ #if false -template<typename sgntyp> constexpr auto zp::fmt(::zp::c02 * buf,sgntyp sgnval,::zp::i8m const bs,bool const rtl) noexcept -> void { +template<typename sgntyp> constexpr auto zp::fmt(::zp::c02 * buf,sgntyp sgnval,::zp::i8 const bs,bool const rtl) noexcept -> void { using typ = typename ::zp::usgn<sgntyp>::typ; ::zp::c02 const * digs = U"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; @@ -31,7 +31,7 @@ template<typename sgntyp> constexpr auto zp::fmt(::zp::c02 * buf,sgntyp sgnval,: #endif #if false -template<typename typ> constexpr auto zp::fmtlen(typ val,::zp::i8m const bs) noexcept -> ::zp::siz { +template<typename typ> constexpr auto zp::fmtlen(typ val,::zp::i8 const bs) noexcept -> ::zp::siz { static_assert(::zp::isinttyp<typ>::val,"type must be an integral type"); ::zp::siz len = 0x0u; @@ -47,7 +47,7 @@ template<typename typ> constexpr auto zp::fmtlen(typ val,::zp::i8m const bs) noe } #endif -template<typename typ> zp_nothw ::zp::siz zp::prv::numdig(typ fmtval,::zp::i8m const bs) { +template<typename typ> zp_nothw ::zp::siz zp::prv::numdig(typ fmtval,::zp::i8 const bs) { //static_assert(::zp::isinttyp<typ>::val,"type must be an integral type"); if (fmtval == typ (0x0)) return 0x1u; diff --git a/zp/include/zp/imp/zp.ii b/zp/include/zp/imp/zp.ii index ad7c1b6..f49d346 100644 --- a/zp/include/zp/imp/zp.ii +++ b/zp/include/zp/imp/zp.ii @@ -5,7 +5,7 @@ */ #if zp_std_cxx11 -constexpr auto zp::iscstevl() noexcept -> bool { +constexpr auto ::zp::iscstevl() noexcept -> bool { #if zp_prv_hasbltin(__builtin_is_constant_evaluated) return __builtin_is_constant_evaluated(); #elif __cpp_if_consteval >= 202106 @@ -16,3 +16,32 @@ constexpr auto zp::iscstevl() noexcept -> bool { #endif } #endif + +#if zp_std_cxx11 +template<typename typ> constexpr ::zp::opt<typ>::opt(::zp::det::nulopt) noexcept : hasval(false),valval(typ {}) { +} + +template<typename typ> constexpr ::zp::opt<typ>::opt(typ const & val) noexcept : hasval(true),valval(val) { +} + +template<typename typ> constexpr auto ::zp::opt<typ>::chk() const noexcept -> bool { + return this->hasval; +} + +template<typename typ> constexpr auto ::zp::opt<typ>::val() const noexcept -> typ { + return this->valval; +} + +template<typename typ> template<typename funtyp,typename msgtyp> auto ::zp::opt<typ>::exp(funtyp const & fun,msgtyp const & msg) const -> typ { + zp_lik (this->hasval) {return this->valval;} + fun(msg); + ::zp::unrch(); +} + +template<typename typ> constexpr auto ::zp::opt<typ>::operator = (typ const & val) noexcept -> ::zp::opt<typ> { + this->hasval = true; + this->valval = val; + + return *this; +} +#endif diff --git a/zp/include/zp/mth b/zp/include/zp/mth index af419d4..0c94ef5 100644 --- a/zp/include/zp/mth +++ b/zp/include/zp/mth @@ -11,20 +11,6 @@ #include <zp/mth.h> namespace zp { -#if zp_std_cxx11 - template<typename typ> struct inf {constexpr static typ val = ::zp::maxval<typ>::val;}; - - template<> struct inf<double> {constexpr static double const val = zp_inff;}; - template<> struct inf<double long> {constexpr static double long const val = zp_infld;}; - template<> struct inf<float> {constexpr static float const val = zp_infd;}; - - template<typename typ> struct nan {constexpr static typ val = typ {0x0};}; - - template<> struct nan<double> {constexpr static double const val = zp_nanf;}; - template<> struct nan<double long> {constexpr static double long const val = zp_nanld;}; - template<> struct nan<float> {constexpr static float const val = zp_nand;}; -#endif - template<typename typ> struct divmodres { typ lval; typ rval; @@ -46,215 +32,115 @@ namespace zp { typ w; }; -#if zp_std_cxx14 - namespace cst { - template<typename typ> zp_useres constexpr auto isnan(typ const val) noexcept -> bool { - static_assert(::zp::isarityp<typ>::val,"type must be an arithmetic type"); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f02 abs(::zp::f02 val); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f04 abs(::zp::f04 val); - if (::zp::isinttyp<typ>::val) {return false;} + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f02 acos(::zp::f02 val); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f04 acos(::zp::f04 val); - return val != val; - } + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f02 acot(::zp::f02 val); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f04 acot(::zp::f04 val); - template<typename typ> zp_useres constexpr auto abs(typ const val) noexcept -> typename ::zp::usgn<typ>::typ { - static_assert(::zp::isarityp<typ>::val,"type must be an arithmetic type"); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f02 acsc(::zp::f02 val); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f04 acsc(::zp::f04 val); - if (::zp::isusgn<typ>::val) {return val;} + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f02 asec(::zp::f02 val); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f04 asec(::zp::f04 val); - using newtyp = typename ::zp::usgn<typ>::typ; // The type is unchanged if it was a floating-point type. + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f02 asin(::zp::f02 val); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f04 asin(::zp::f04 val); - return newtyp {0x0}-static_cast<newtyp>(val); - } + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f02 atan(::zp::f02 val); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f04 atan(::zp::f04 val); - template<typename typ> zp_useres constexpr auto dot2(::zp::vec2<typ> const lvec,::zp::vec2<typ> const rvec) noexcept -> typ { - static_assert(::zp::isarityp<typ>::val,"type must be an arithmetic type"); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f02 zp_atan2f02(::zp::f02 y,::zp::f02 x); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f04 zp_atan2f04(::zp::f04 y,::zp::f04 x); - return lvec.x*rvec.x+lvec.y*rvec.y; - } + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f02 cbrt(::zp::f02 val); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f04 cbrt(::zp::f04 val); - template<typename typ> zp_useres constexpr auto dot3(::zp::vec3<typ> const lvec,::zp::vec3<typ> const rvec) noexcept -> typ { - static_assert(::zp::isarityp<typ>::val,"type must be an arithmetic type"); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f02 cos(::zp::f02 ang); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f04 cos(::zp::f04 ang); - return lvec.x*rvec.x+lvec.y*rvec.y+lvec.z*rvec.z; - } + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f02 cot(::zp::f02 ang); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f04 cot(::zp::f04 ang); - template<typename typ> zp_useres constexpr auto dot4(::zp::vec4<typ> const lvec,::zp::vec4<typ> const rvec) noexcept -> typ { - static_assert(::zp::isarityp<typ>::val,"type must be an arithmetic type"); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f02 csc(::zp::f02 ang); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f04 csc(::zp::f04 ang); - return lvec.x*rvec.x+lvec.y*rvec.y+lvec.z*rvec.z+lvec.w*rvec.w; - } + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f02 zp_dst2f02(::zp::f02 x,::zp::f02 y); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f04 zp_dst2f04(::zp::f04 x,::zp::f04 y); - template<typename typ> zp_useres constexpr auto vadd2(::zp::vec2<typ> const lvec,::zp::vec2<typ> const rvec) noexcept -> ::zp::vec2<typ> { - static_assert(::zp::isarityp<typ>::val,"type must be an arithmetic type"); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f02 zp_dst3f02(::zp::f02 x,::zp::f02 y,::zp::f02 z); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f04 zp_dst3f04(::zp::f04 x,::zp::f04 y,::zp::f04 z); - return ::zp::vec2<typ> {lvec.x+rvec.x,lvec.y+rvec.y}; - } + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f02 zp_dst4f02(::zp::f02 x,::zp::f02 y,::zp::f02 z,::zp::f02 w); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f04 zp_dst4f04(::zp::f04 x,::zp::f04 y,::zp::f04 z,::zp::f04 w); - template<typename typ> zp_useres constexpr auto vadd3(::zp::vec3<typ> const lvec,::zp::vec3<typ> const rvec) noexcept -> ::zp::vec3<typ> { - static_assert(::zp::isarityp<typ>::val,"type must be an arithmetic type"); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::divmodres<i8s> zp_divmodi8s( ::zp::i8s num,::zp::i8s den); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::divmodres<i01s> zp_divmodi01s(::zp::i01s num,::zp::i01s den); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::divmodres<i02s> zp_divmodi02s(::zp::i02s num,::zp::i02s den); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::divmodres<i04s> zp_divmodi04s(::zp::i04s num,::zp::i04s den); - return ::zp::vec3<typ> {lvec.x+rvec.x,lvec.y+rvec.y,lvec.z+rvec.z}; - } + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f02 zp_dot2f02(::zp::vec2< ::zp::f02> lvec,::zp::vec2< ::zp::f02> rvec); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f04 zp_dot2f04(::zp::vec2< ::zp::f04> lvec,::zp::vec2< ::zp::f04> rvec); - template<typename typ> zp_useres constexpr auto vadd4(::zp::vec4<typ> const lvec,::zp::vec4<typ> const rvec) noexcept -> ::zp::vec4<typ> { - static_assert(::zp::isarityp<typ>::val,"type must be an arithmetic type"); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f02 zp_dot3f02(::zp::vec3< ::zp::f02> lvec,::zp::vec3< ::zp::f02> rvec); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f04 zp_dot3f04(::zp::vec3< ::zp::f04> lvec,::zp::vec3< ::zp::f04> rvec); - return ::zp::vec4<typ> {lvec.x+rvec.x,lvec.y+rvec.y,lvec.z+rvec.z,lvec.w+rvec.w}; - } - } -#endif + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f02 zp_dot4f02(::zp::vec4< ::zp::f02> lvec,::zp::vec4< ::zp::f02> rvec); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f04 zp_dot4f04(::zp::vec4< ::zp::f04> lvec,::zp::vec4< ::zp::f04> rvec); + + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f02 exp(::zp::f02 val,::zp::f02 n); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f04 exp(::zp::f04 val,::zp::f04 n); + + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f02 lb(::zp::f02 val); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f04 lb(::zp::f04 val); + + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f02 lg(::zp::f02 val); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f04 lg(::zp::f04 val); + + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f02 ln(::zp::f02 val); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f04 ln(::zp::f04 val); - zp_iln zp_nothw zp_unseq zp_useres inline double isnan(double const val) {return zp_isnand( val);} - zp_iln zp_nothw zp_unseq zp_useres inline double long isnan(double long const val) {return zp_isnandl(val);} - zp_iln zp_nothw zp_unseq zp_useres inline float isnan(float const val) {return zp_isnanf( val);} + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f02 log(::zp::f02 val,::zp::f02 n); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f04 log(::zp::f04 val,::zp::f04 n); - zp_iln zp_nothw zp_unseq zp_useres inline float abs(float const val) {return ::zp_absf( val);} - zp_iln zp_nothw zp_unseq zp_useres inline double abs(double const val) {return ::zp_absd( val);} - zp_iln zp_nothw zp_unseq zp_useres inline double long abs(double long const val) {return ::zp_absdl(val);} + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f02 nrt(::zp::f02 val,::zp::f02 n); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f04 nrt(::zp::f04 val,::zp::f04 n); - zp_iln zp_nothw zp_unseq zp_useres inline float acos(float const val) {return ::zp_acosf( val);} - zp_iln zp_nothw zp_unseq zp_useres inline double acos(double const val) {return ::zp_acosd( val);} - zp_iln zp_nothw zp_unseq zp_useres inline double long acos(double long const val) {return ::zp_acosdl(val);} + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f02 sec(::zp::f02 ang); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f04 sec(::zp::f04 ang); - zp_iln zp_nothw zp_unseq zp_useres inline float zp_acot(float const val) {return ::zp_acotf( val);} - zp_iln zp_nothw zp_unseq zp_useres inline double zp_acot(double const val) {return ::zp_acotd( val);} - zp_iln zp_nothw zp_unseq zp_useres inline double long zp_acot(double long const val) {return ::zp_acotdl(val);} + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f02 sin(::zp::f02 ang); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f04 sin(::zp::f04 ang); - zp_iln zp_nothw zp_unseq zp_useres inline float zp_acsc(float const val) {return ::zp_acscf( val);} - zp_iln zp_nothw zp_unseq zp_useres inline double zp_acsc(double const val) {return ::zp_acscd( val);} - zp_iln zp_nothw zp_unseq zp_useres inline double long zp_acsc(double long const val) {return ::zp_acscdl(val);} + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f02 sqrt(::zp::f02 val); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f04 sqrt(::zp::f04 val); - zp_iln zp_nothw zp_unseq zp_useres inline float asec(float const val) {return ::zp_asecf( val);} - zp_iln zp_nothw zp_unseq zp_useres inline double asec(double const val) {return ::zp_asecd( val);} - zp_iln zp_nothw zp_unseq zp_useres inline double long asec(double long const val) {return ::zp_asecdl(val);} + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f02 tan(::zp::f02 ang); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f04 tan(::zp::f04 ang); - zp_iln zp_nothw zp_unseq zp_useres inline float asin(float const val) {return ::zp_asinf( val);} - zp_iln zp_nothw zp_unseq zp_useres inline double asin(double const val) {return ::zp_asind( val);} - zp_iln zp_nothw zp_unseq zp_useres inline double long asin(double long const val) {return ::zp_asindl(val);} + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f02 tsrt(::zp::f02 val); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::f04 tsrt(::zp::f04 val); - zp_iln zp_nothw zp_unseq zp_useres inline float atan(float const val) {return ::zp_atanf( val);} - zp_iln zp_nothw zp_unseq zp_useres inline double atan(double const val) {return ::zp_atand( val);} - zp_iln zp_nothw zp_unseq zp_useres inline double long atan(double long const val) {return ::zp_atandl(val);} + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::vec2< ::zp::f02> zp_vadd2(::zp::vec2< ::zp::f02> lvec,::zp::vec2< ::zp::f02> rvec); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::vec2< ::zp::f04> zp_vadd2(::zp::vec2< ::zp::f04> lvec,::zp::vec2< ::zp::f04> rvec); - zp_iln zp_nothw zp_unseq zp_useres inline float atan2(float const y,float const x) {return ::zp_atan2f( y,x);} - zp_iln zp_nothw zp_unseq zp_useres inline double atan2(double const y,double const x) {return ::zp_atan2d( y,x);} - zp_iln zp_nothw zp_unseq zp_useres inline double long atan2(double long const y,double long const x) {return ::zp_atan2dl(y,x);} + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::vec3< ::zp::f02> zp_vadd3(::zp::vec3< ::zp::f02> lvec,::zp::vec3< ::zp::f02> rvec); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::vec3< ::zp::f04> zp_vadd3(::zp::vec3< ::zp::f04> lvec,::zp::vec3< ::zp::f04> rvec); - zp_iln zp_nothw zp_unseq zp_useres inline float cbrt(float const val) {return ::zp_cbrtf( val);} - zp_iln zp_nothw zp_unseq zp_useres inline double cbrt(double const val) {return ::zp_cbrtd( val);} - zp_iln zp_nothw zp_unseq zp_useres inline double long cbrt(double long const val) {return ::zp_cbrtdl(val);} + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::vec4< ::zp::f02> zp_v4add(::zp::vec4< ::zp::f02> lvec,::zp::vec4< ::zp::f02> rvec); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::vec4< ::zp::f04> zp_v4add(::zp::vec4< ::zp::f04> lvec,::zp::vec4< ::zp::f04> rvec); - zp_iln zp_nothw zp_unseq zp_useres inline float cos(float const ang) {return ::zp_cosf( ang);} - zp_iln zp_nothw zp_unseq zp_useres inline double cos(double const ang) {return ::zp_cosd( ang);} - zp_iln zp_nothw zp_unseq zp_useres inline double long cos(double long const ang) {return ::zp_cosdl(ang);} + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::vec2< ::zp::f02> zp_vsub2(::zp::vec2< ::zp::f02> lvec,::zp::vec2< ::zp::f02> rvec); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::vec2< ::zp::f04> zp_vsub2(::zp::vec2< ::zp::f04> lvec,::zp::vec2< ::zp::f04> rvec); - zp_iln zp_nothw zp_unseq zp_useres inline float cot(float const ang) {return ::zp_cotf( ang);} - zp_iln zp_nothw zp_unseq zp_useres inline double cot(double const ang) {return ::zp_cotd( ang);} - zp_iln zp_nothw zp_unseq zp_useres inline double long cot(double long const ang) {return ::zp_cotdl(ang);} + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::vec3< ::zp::f02> zp_vsub3(::zp::vec3< ::zp::f02> lvec,::zp::vec3< ::zp::f02> rvec); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::vec3< ::zp::f04> zp_vsub3(::zp::vec3< ::zp::f04> lvec,::zp::vec3< ::zp::f04> rvec); - zp_iln zp_nothw zp_unseq zp_useres inline float csc(float const ang) {return ::zp_cscf( ang);} - zp_iln zp_nothw zp_unseq zp_useres inline double csc(double const ang) {return ::zp_cscd( ang);} - zp_iln zp_nothw zp_unseq zp_useres inline double long csc(double long const ang) {return ::zp_cscdl(ang);} - - zp_iln zp_nothw zp_unseq zp_useres inline float dist2(float const x,float const y) {return ::zp_dst2f( x,y);} - zp_iln zp_nothw zp_unseq zp_useres inline double dist2(double const x,double const y) {return ::zp_dst2d( x,y);} - zp_iln zp_nothw zp_unseq zp_useres inline double long dist2(double long const x,double long const y) {return ::zp_dst2dl(x,y);} - - zp_iln zp_nothw zp_unseq zp_useres inline float dist3(float const x,float const y,float const z) {return ::zp_dst3f( x,y,z);} - zp_iln zp_nothw zp_unseq zp_useres inline double dist3(double const x,double const y,double const z) {return ::zp_dst3d( x,y,z);} - zp_iln zp_nothw zp_unseq zp_useres inline double long dist3(double long const x,double long const y,double long const z) {return ::zp_dst3dl(x,y,z);} - - zp_iln zp_nothw zp_unseq zp_useres inline float dist4(float const x,float const y,float const z,float w) {return ::zp_dst4f( x,y,z,w);} - zp_iln zp_nothw zp_unseq zp_useres inline double dist4(double const x,double const y,double const z,double w) {return ::zp_dst4d( x,y,z,w);} - zp_iln zp_nothw zp_unseq zp_useres inline double long dist4(double long const x,double long const y,double long const z,double long w) {return ::zp_dst4dl(x,y,z,w);} - - zp_iln zp_nothw zp_unseq zp_useres inline ::zp::divmodres<char signed> divmod(char signed const num,char signed den); - zp_iln zp_nothw zp_unseq zp_useres inline ::zp::divmodres<short> divmod(short const num,short den); - zp_iln zp_nothw zp_unseq zp_useres inline ::zp::divmodres<int> divmod(int const num,int den); - zp_iln zp_nothw zp_unseq zp_useres inline ::zp::divmodres<long> divmod(long const num,long den); - #if zp_std_c99 || zp_std_cxx11 - zp_iln zp_nothw zp_unseq zp_useres inline ::zp::divmodres<long long> divmodl(long long const num,long long den); - #endif - - zp_iln zp_nothw zp_unseq zp_useres inline float dot2(::zp::vec2<float> const lvec,::zp::vec2<float> const rvec); - zp_iln zp_nothw zp_unseq zp_useres inline double dot2(::zp::vec2<double> const lvec,::zp::vec2<double> const rvec); - zp_iln zp_nothw zp_unseq zp_useres inline double long dot2(::zp::vec2<double long> const lvec,::zp::vec2<double long> const rvec); - - zp_iln zp_nothw zp_unseq zp_useres inline float dot3(::zp::vec3<float> const lvec,::zp::vec3<float> const rvec); - zp_iln zp_nothw zp_unseq zp_useres inline double dot3(::zp::vec3<double> const lvec,::zp::vec3<double> const rvec); - zp_iln zp_nothw zp_unseq zp_useres inline double long dot3(::zp::vec3<double long> const lvec,::zp::vec3<double long> const rvec); - - zp_iln zp_nothw zp_unseq zp_useres inline float dot4(::zp::vec4<float> const lvec,::zp::vec4<float> const rvec); - zp_iln zp_nothw zp_unseq zp_useres inline double dot4(::zp::vec4<double> const lvec,::zp::vec4<double> const rvec); - zp_iln zp_nothw zp_unseq zp_useres inline double long dot4(::zp::vec4<double long> const lvec,::zp::vec4<double long> const rvec); - - zp_iln zp_nothw zp_unseq zp_useres inline float exp(float const val,float n) {return ::zp_expf( val,n);} - zp_iln zp_nothw zp_unseq zp_useres inline double exp(double const val,double n) {return ::zp_expd( val,n);} - zp_iln zp_nothw zp_unseq zp_useres inline double long exp(double long const val,double long n) {return ::zp_expdl(val,n);} - - zp_iln zp_nothw zp_unseq zp_useres inline float lb(float const val) {return ::zp_lbf( val);} - zp_iln zp_nothw zp_unseq zp_useres inline double lb(double const val) {return ::zp_lbd( val);} - zp_iln zp_nothw zp_unseq zp_useres inline double long lb(double long const val) {return ::zp_lbdl(val);} - - zp_iln zp_nothw zp_unseq zp_useres inline float lg(float const val) {return ::zp_lgf( val);} - zp_iln zp_nothw zp_unseq zp_useres inline double lg(double const val) {return ::zp_lgd( val);} - zp_iln zp_nothw zp_unseq zp_useres inline double long lg(double long const val) {return ::zp_lgdl(val);} - - zp_iln zp_nothw zp_unseq zp_useres inline float ln(float const val) {return ::zp_lnf( val);} - zp_iln zp_nothw zp_unseq zp_useres inline double ln(double const val) {return ::zp_lnd( val);} - zp_iln zp_nothw zp_unseq zp_useres inline double long ln(double long const val) {return ::zp_lndl(val);} - - zp_iln zp_nothw zp_unseq zp_useres inline float log(float const val,float n) {return ::zp_logf( val,n);} - zp_iln zp_nothw zp_unseq zp_useres inline double log(double const val,double n) {return ::zp_logd( val,n);} - zp_iln zp_nothw zp_unseq zp_useres inline double long log(double long const val,double long n) {return ::zp_logdl(val,n);} - - zp_iln zp_nothw zp_unseq zp_useres inline float nrt(float const val,float n) {return ::zp_nrtf( val,n);} - zp_iln zp_nothw zp_unseq zp_useres inline double nrt(double const val,double n) {return ::zp_nrtd( val,n);} - zp_iln zp_nothw zp_unseq zp_useres inline double long nrt(double long const val,double long n) {return ::zp_nrtdl(val,n);} - - zp_iln zp_nothw zp_unseq zp_useres inline float sec(float const ang) {return ::zp_secf( ang);} - zp_iln zp_nothw zp_unseq zp_useres inline double sec(double const ang) {return ::zp_secd( ang);} - zp_iln zp_nothw zp_unseq zp_useres inline double long sec(double long const ang) {return ::zp_secdl(ang);} - - zp_iln zp_nothw zp_unseq zp_useres inline float sin(float const ang) {return ::zp_sinf( ang);} - zp_iln zp_nothw zp_unseq zp_useres inline double sin(double const ang) {return ::zp_sind( ang);} - zp_iln zp_nothw zp_unseq zp_useres inline double long sin(double long const ang) {return ::zp_sindl(ang);} - - zp_iln zp_nothw zp_unseq zp_useres inline float sqrt(float const val) {return ::zp_sqrtf( val);;} - zp_iln zp_nothw zp_unseq zp_useres inline double sqrt(double const val) {return ::zp_sqrtd( val);;} - zp_iln zp_nothw zp_unseq zp_useres inline double long sqrt(double long const val) {return ::zp_sqrtdl(val);;} - - zp_iln zp_nothw zp_unseq zp_useres inline float tan(float const ang) {return ::zp_tanf( ang);} - zp_iln zp_nothw zp_unseq zp_useres inline double tan(double const ang) {return ::zp_tand( ang);} - zp_iln zp_nothw zp_unseq zp_useres inline double long tan(double long const ang) {return ::zp_tandl(ang);} - - zp_iln zp_nothw zp_unseq zp_useres inline float tsrt(float const val) {return ::zp_tsrtf( val);} - zp_iln zp_nothw zp_unseq zp_useres inline double tsrt(double const val) {return ::zp_tsrtd( val);} - zp_iln zp_nothw zp_unseq zp_useres inline double long tsrt(double long const val) {return ::zp_tsrtdl(val);} - - zp_iln zp_nothw zp_unseq zp_useres inline ::zp::vec2<float> vadd2f( ::zp::vec2<float> const lvec,::zp::vec2<float> const rvec); - zp_iln zp_nothw zp_unseq zp_useres inline ::zp::vec2<double> vadd2d( ::zp::vec2<double> const lvec,::zp::vec2<double> const rvec); - zp_iln zp_nothw zp_unseq zp_useres inline ::zp::vec2<double long> vadd2dl(::zp::vec2<double long> const lvec,::zp::vec2<double long> const rvec); - - zp_iln zp_nothw zp_unseq zp_useres inline ::zp::vec3<float> vadd3f( ::zp::vec3<float> const lvec,::zp::vec3<float> const rvec); - zp_iln zp_nothw zp_unseq zp_useres inline ::zp::vec3<double> vadd3d( ::zp::vec3<double> const lvec,::zp::vec3<double> const rvec); - zp_iln zp_nothw zp_unseq zp_useres inline ::zp::vec3<double long> vadd3dl(::zp::vec3<double long> const lvec,::zp::vec3<double long> const rvec); - - zp_iln zp_nothw zp_unseq zp_useres inline ::zp::vec4<float> vadd4f( ::zp::vec4<float> const lvec,::zp::vec4<float> const rvec); - zp_iln zp_nothw zp_unseq zp_useres inline ::zp::vec4<double> vadd4d( ::zp::vec4<double> const lvec,::zp::vec4<double> const rvec); - zp_iln zp_nothw zp_unseq zp_useres inline ::zp::vec4<double long> vadd4dl(::zp::vec4<double long> const lvec,::zp::vec4<double long> const rvec); - - zp_iln zp_nothw zp_unseq zp_useres inline ::zp::vec2<float> vsub2f( ::zp::vec2<float> const lvec,::zp::vec2<float> const rvec); - zp_iln zp_nothw zp_unseq zp_useres inline ::zp::vec2<double> vsub2d( ::zp::vec2<double> const lvec,::zp::vec2<double> const rvec); - zp_iln zp_nothw zp_unseq zp_useres inline ::zp::vec2<double long> vsub2dl(::zp::vec2<double long> const lvec,::zp::vec2<double long> const rvec); - - zp_iln zp_nothw zp_unseq zp_useres inline ::zp::vec3<float> vsub3f( ::zp::vec3<float> const lvec,::zp::vec3<float> const rvec); - zp_iln zp_nothw zp_unseq zp_useres inline ::zp::vec3<double> vsub3d( ::zp::vec3<double> const lvec,::zp::vec3<double> const rvec); - zp_iln zp_nothw zp_unseq zp_useres inline ::zp::vec3<double long> vsub3dl(::zp::vec3<double long> const lvec,::zp::vec3<double long> const rvec); - - zp_iln zp_nothw zp_unseq zp_useres inline ::zp::vec4<float> vsub4f( ::zp::vec4<float> const lvec,::zp::vec4<float> const rvec); - zp_iln zp_nothw zp_unseq zp_useres inline ::zp::vec4<double> vsub4d( ::zp::vec4<double> const lvec,::zp::vec4<double> const rvec); - zp_iln zp_nothw zp_unseq zp_useres inline ::zp::vec4<double long> vsub4dl(::zp::vec4<double long> const lvec,::zp::vec4<double long> const rvec); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::vec4< ::zp::f02> zp_v4sub(::zp::vec4< ::zp::f02> lvec,::zp::vec4< ::zp::f02> rvec); + zp_iln zp_nothw zp_unseq zp_useres inline ::zp::vec4< ::zp::f04> zp_v4sub(::zp::vec4< ::zp::f04> lvec,::zp::vec4< ::zp::f04> rvec); } #endif diff --git a/zp/include/zp/mth.h b/zp/include/zp/mth.h index 1a4790a..5166d10 100644 --- a/zp/include/zp/mth.h +++ b/zp/include/zp/mth.h @@ -11,297 +11,205 @@ zp_prv_cdecl -#if zp_prv_hasbltin(__builtin_huge_val) -#define zp_infd (__builtin_huge_val()) -#else -#define zp_infd (zp_maxvald) -#endif -#if zp_prv_hasbltin(__builtin_huge_valf) -#define zp_inff (__builtin_huge_valf()) -#else -#define zp_inff (zp_maxvalf) -#endif -#if zp_prv_hasbltin(__builtin_huge_vall) -#define zp_infld (__builtin_huge_vall()) -#else -#define zp_infld (zp_maxvaldl) -#endif - -#if zp_prv_hasbltin(__builtin_nan) -#define zp_nand (__builtin_nan("")) -#else -#define zp_nand (0.0); -#endif -#if zp_prv_hasbltin(__builtin_nanf) -#define zp_nanf (__builtin_nanf("")) -#else -#define zp_nanf (0.0f); -#endif -#if zp_prv_hasbltin(__builtin_nanl) -#define zp_nanld (__builtin_nanl("")) -#else -#define zp_nanld (0.0l); -#endif - -typedef struct { - char signed lval; - char signed rval; -} zp_divmodressc; typedef struct { - short lval; - short rval; -} zp_divmodress; + zp_i8s lval; + zp_i8s rval; +} zp_divmodresi8s; typedef struct { - int lval; - int rval; -} zp_divmodresi; + zp_i01s lval; + zp_i01s rval; +} zp_divmodresi01s; typedef struct { - long lval; - long rval; -} zp_divmodresl; -#if zp_std_c99 || zp_std_cxx11 + zp_i02s lval; + zp_i02s rval; +} zp_divmodresi02s; typedef struct { - long long lval; - long long rval; -} zp_divmodresll; -#endif + zp_i04s lval; + zp_i04s rval; +} zp_divmodresi04s; typedef struct { double x; double y; -} zp_vec2d; -typedef struct { - double long x; - double long y; -} zp_vec2dl; +} zp_vec2f02; typedef struct { - float x; - float y; -} zp_vec2f; + zp_f04 x; + zp_f04 y; +} zp_vec2f04; typedef struct { double x; double y; double z; -} zp_vec3d; +} zp_vec3f02; typedef struct { - double long x; - double long y; - double long z; -} zp_vec3dl; -typedef struct { - float x; - float y; - float z; -} zp_vec3f; + zp_f04 x; + zp_f04 y; + zp_f04 z; +} zp_vec3f04; typedef struct { double x; double y; double z; double w; -} zp_vec4d; -typedef struct { - double long x; - double long y; - double long z; - double long w; -} zp_vec4dl; +} zp_vec4f02; typedef struct { - float x; - float y; - float z; - float w; -} zp_vec4f; + zp_f04 x; + zp_f04 y; + zp_f04 z; + zp_f04 w; +} zp_vec4f04; /* is not-a-number */ -#define zp_isnand( val) ((bool)((val) != (val))) -#define zp_isnandl(val) ((bool)((val) != (val))) -#define zp_isnanf( val) ((bool)((val) != (val))) +#define zp_isnanf02(val) ((bool)((val) != (val))) +#define zp_isnanf04(val) ((bool)((val) != (val))) /* absolute */ -zp_nothw zp_unseq zp_useres double zp_absd( double val); -zp_nothw zp_unseq zp_useres double long zp_absdl(double long val); -zp_nothw zp_unseq zp_useres float zp_absf( float val); +zp_nothw zp_unseq zp_useres zp_f02 zp_absf02(zp_f02 val); +zp_nothw zp_unseq zp_useres zp_f04 zp_absf04(zp_f04 val); /* arccosine */ -zp_nothw zp_unseq zp_useres double zp_acosd( double val); -zp_nothw zp_unseq zp_useres double long zp_acosdl(double long val); -zp_nothw zp_unseq zp_useres float zp_acosf( float val); +zp_nothw zp_unseq zp_useres zp_f02 zp_acosf02(zp_f02 val); +zp_nothw zp_unseq zp_useres zp_f04 zp_acosf04(zp_f04 val); /* arccotangent */ -zp_nothw zp_unseq zp_useres double zp_acotd( double val); -zp_nothw zp_unseq zp_useres double long zp_acotdl(double long val); -zp_nothw zp_unseq zp_useres float zp_acotf( float val); +zp_nothw zp_unseq zp_useres zp_f02 zp_acotf02(zp_f02 val); +zp_nothw zp_unseq zp_useres zp_f04 zp_acotf04(zp_f04 val); /* arccosecant */ -zp_nothw zp_unseq zp_useres double zp_acscd( double val); -zp_nothw zp_unseq zp_useres double long zp_acscdl(double long val); -zp_nothw zp_unseq zp_useres float zp_acscf( float val); +zp_nothw zp_unseq zp_useres zp_f02 zp_acscf02(zp_f02 val); +zp_nothw zp_unseq zp_useres zp_f04 zp_acscf04(zp_f04 val); /* arcsecant */ -zp_nothw zp_unseq zp_useres double zp_asecd( double val); -zp_nothw zp_unseq zp_useres double long zp_asecdl(double long val); -zp_nothw zp_unseq zp_useres float zp_asecf( float val); +zp_nothw zp_unseq zp_useres zp_f02 zp_asecf02(zp_f02 val); +zp_nothw zp_unseq zp_useres zp_f04 zp_asecf04(zp_f04 val); /* arcsine */ -zp_nothw zp_unseq zp_useres double zp_asind( double val); -zp_nothw zp_unseq zp_useres double long zp_asindl(double long val); -zp_nothw zp_unseq zp_useres float zp_asinf( float val); +zp_nothw zp_unseq zp_useres zp_f02 zp_asinf02(zp_f02 val); +zp_nothw zp_unseq zp_useres zp_f04 zp_asinf04(zp_f04 val); /* arctangens */ -zp_nothw zp_unseq zp_useres double zp_atand( double val); -zp_nothw zp_unseq zp_useres double long zp_atandl(double long val); -zp_nothw zp_unseq zp_useres float zp_atanf( float val); +zp_nothw zp_unseq zp_useres zp_f02 zp_atanf02(zp_f02 val); +zp_nothw zp_unseq zp_useres zp_f04 zp_atanf04(zp_f04 val); /* arctangens 2 */ -zp_nothw zp_unseq zp_useres double zp_atan2d( double y,double x); -zp_nothw zp_unseq zp_useres double long zp_atan2dl(double long y,double long x); -zp_nothw zp_unseq zp_useres float zp_atan2f( float y,float x); +zp_nothw zp_unseq zp_useres zp_f02 zp_atan2f02(zp_f02 y,zp_f02 x); +zp_nothw zp_unseq zp_useres zp_f04 zp_atan2f04(zp_f04 y,zp_f04 x); /* cube root */ -zp_nothw zp_unseq zp_useres double zp_cbrtd( double val); -zp_nothw zp_unseq zp_useres double long zp_cbrtdl(double long val); -zp_nothw zp_unseq zp_useres float zp_cbrtf( float val); +zp_nothw zp_unseq zp_useres zp_f02 zp_cbrtf02(zp_f02 val); +zp_nothw zp_unseq zp_useres zp_f04 zp_cbrtf04(zp_f04 val); /* cosine */ -zp_nothw zp_unseq zp_useres double zp_cosd( double ang); -zp_nothw zp_unseq zp_useres double long zp_cosdl(double long ang); -zp_nothw zp_unseq zp_useres float zp_cosf( float ang); +zp_nothw zp_unseq zp_useres zp_f02 zp_cosf02(zp_f02 ang); +zp_nothw zp_unseq zp_useres zp_f04 zp_cosf04(zp_f04 ang); /* cotangent */ -zp_nothw zp_unseq zp_useres double zp_cotd( double ang); -zp_nothw zp_unseq zp_useres double long zp_cotdl(double long ang); -zp_nothw zp_unseq zp_useres float zp_cotf( float ang); +zp_nothw zp_unseq zp_useres zp_f02 zp_cotf02(zp_f02 ang); +zp_nothw zp_unseq zp_useres zp_f04 zp_cotf04(zp_f04 ang); /* cosecant */ -zp_nothw zp_unseq zp_useres double zp_cscd( double ang); -zp_nothw zp_unseq zp_useres double long zp_cscdl(double long ang); -zp_nothw zp_unseq zp_useres float zp_cscf( float ang); +zp_nothw zp_unseq zp_useres zp_f02 zp_cscf02(zp_f02 ang); +zp_nothw zp_unseq zp_useres zp_f04 zp_cscf04(zp_f04 ang); /* two-space distance */ -zp_nothw zp_unseq zp_useres double zp_dst2d( double x,double y); -zp_nothw zp_unseq zp_useres double long zp_dst2dl(double long x,double long y); -zp_nothw zp_unseq zp_useres float zp_dst2f( float x,float y); +zp_nothw zp_unseq zp_useres zp_f02 zp_dst2f02(zp_f02 x,zp_f02 y); +zp_nothw zp_unseq zp_useres zp_f04 zp_dst2f04(zp_f04 x,zp_f04 y); /* three-space distance */ -zp_nothw zp_unseq zp_useres double zp_dst3d( double x,double y,double z); -zp_nothw zp_unseq zp_useres double long zp_dst3dl(double long x,double long y,double long z); -zp_nothw zp_unseq zp_useres float zp_dst3f( float x,float y,float z); +zp_nothw zp_unseq zp_useres zp_f02 zp_dst3f02(zp_f02 x,zp_f02 y,zp_f02 z); +zp_nothw zp_unseq zp_useres zp_f04 zp_dst3f04(zp_f04 x,zp_f04 y,zp_f04 z); /* four-space distance */ -zp_nothw zp_unseq zp_useres double zp_dst4d( double x,double y,double z,double w); -zp_nothw zp_unseq zp_useres double long zp_dst4dl(double long x,double long y,double long z,double long w); -zp_nothw zp_unseq zp_useres float zp_dst4f( float x,float y,float z,float w); +zp_nothw zp_unseq zp_useres zp_f02 zp_dst4f02(zp_f02 x,zp_f02 y,zp_f02 z,zp_f02 w); +zp_nothw zp_unseq zp_useres zp_f04 zp_dst4f04(zp_f04 x,zp_f04 y,zp_f04 z,zp_f04 w); /* division-modulo */ -zp_nothw zp_unseq zp_useres zp_divmodressc zp_divmodsc(char signed num,char signed den); -zp_nothw zp_unseq zp_useres zp_divmodress zp_divmods( short num,short den); -zp_nothw zp_unseq zp_useres zp_divmodresi zp_divmodi( int num,int den); -zp_nothw zp_unseq zp_useres zp_divmodresl zp_divmodl( long num,long den); -#if zp_std_c99 || zp_std_cxx11 -zp_nothw zp_unseq zp_useres zp_divmodresll zp_divmodll(long long num,long long den); -#endif +zp_nothw zp_unseq zp_useres zp_divmodresi8s zp_divmodi8s( zp_i8s num,zp_i8s den); +zp_nothw zp_unseq zp_useres zp_divmodresi01s zp_divmodi01s(zp_i01s num,zp_i01s den); +zp_nothw zp_unseq zp_useres zp_divmodresi02s zp_divmodi02s(zp_i02s num,zp_i02s den); +zp_nothw zp_unseq zp_useres zp_divmodresi04s zp_divmodi04s(zp_i04s num,zp_i04s den); /* two-space dot product */ -zp_nothw zp_unseq zp_useres float zp_dot2f( zp_vec2f lvec,zp_vec2f rvec); -zp_nothw zp_unseq zp_useres double zp_dot2d( zp_vec2d lvec,zp_vec2d rvec); -zp_nothw zp_unseq zp_useres double long zp_dot2dl(zp_vec2dl lvec,zp_vec2dl rvec); +zp_nothw zp_unseq zp_useres zp_f02 zp_dot2f02(zp_vec2f02 lvec,zp_vec2f02 rvec); +zp_nothw zp_unseq zp_useres zp_f04 zp_dot2f04(zp_vec2f04 lvec,zp_vec2f04 rvec); /* three-space dot product */ -zp_nothw zp_unseq zp_useres float zp_dot3f( zp_vec3f lvec,zp_vec3f rvec); -zp_nothw zp_unseq zp_useres double zp_dot3d( zp_vec3d lvec,zp_vec3d rvec); -zp_nothw zp_unseq zp_useres double long zp_dot3dl(zp_vec3dl lvec,zp_vec3dl rvec); +zp_nothw zp_unseq zp_useres zp_f02 zp_dot3f02(zp_vec3f02 lvec,zp_vec3f02 rvec); +zp_nothw zp_unseq zp_useres zp_f04 zp_dot3f04(zp_vec3f04 lvec,zp_vec3f04 rvec); /* four-space dot product */ -zp_nothw zp_unseq zp_useres float zp_dot4f( zp_vec4f lvec,zp_vec4f rvec); -zp_nothw zp_unseq zp_useres double zp_dot4d( zp_vec4d lvec,zp_vec4d rvec); -zp_nothw zp_unseq zp_useres double long zp_dot4dl(zp_vec4dl lvec,zp_vec4dl rvec); +zp_nothw zp_unseq zp_useres zp_f02 zp_dot4f02(zp_vec4f02 lvec,zp_vec4f02 rvec); +zp_nothw zp_unseq zp_useres zp_f04 zp_dot4f04(zp_vec4f04 lvec,zp_vec4f04 rvec); /* exponentation */ -zp_nothw zp_unseq zp_useres float zp_expd( float val,float n); -zp_nothw zp_unseq zp_useres double zp_expf( double val,double n); -zp_nothw zp_unseq zp_useres double long zp_expdl(double long val,double long n); +zp_nothw zp_unseq zp_useres zp_f02 zp_expf02(zp_f02 val,zp_f02 n); +zp_nothw zp_unseq zp_useres zp_f04 zp_expf04(zp_f04 val,zp_f04 n); /* binary logarithm */ -zp_nothw zp_unseq zp_useres double zp_lbd( double val); -zp_nothw zp_unseq zp_useres double long zp_lbdl(double long val); -zp_nothw zp_unseq zp_useres float zp_lbf( float val); +zp_nothw zp_unseq zp_useres zp_f02 zp_lbf02(zp_f02 val); +zp_nothw zp_unseq zp_useres zp_f04 zp_lbf04(zp_f04 val); /* common logarithm */ -zp_nothw zp_unseq zp_useres double zp_lgd( double val); -zp_nothw zp_unseq zp_useres double long zp_lgdl(double long val); -zp_nothw zp_unseq zp_useres float zp_lgf( float val); +zp_nothw zp_unseq zp_useres zp_f02 zp_lgf02(zp_f02 val); +zp_nothw zp_unseq zp_useres zp_f04 zp_lgf04(zp_f04 val); /* natual logarithm */ -zp_nothw zp_unseq zp_useres double zp_lnd( double val); -zp_nothw zp_unseq zp_useres double long zp_lndl(double long val); -zp_nothw zp_unseq zp_useres float zp_lnf( float val); +zp_nothw zp_unseq zp_useres zp_f02 zp_lnf02(zp_f02 val); +zp_nothw zp_unseq zp_useres zp_f04 zp_lnf04(zp_f04 val); /* logarithm */ -zp_nothw zp_unseq zp_useres double zp_logd( double val,double n); -zp_nothw zp_unseq zp_useres double long zp_logdl(double long val,double long n); -zp_nothw zp_unseq zp_useres float zp_logf( float val,float n); +zp_nothw zp_unseq zp_useres zp_f02 zp_logf02(zp_f02 val,zp_f02 n); +zp_nothw zp_unseq zp_useres zp_f04 zp_logf04(zp_f04 val,zp_f04 n); /* nth root */ -zp_nothw zp_unseq zp_useres double zp_nrtd( double val,double n); -zp_nothw zp_unseq zp_useres double long zp_nrtdl(double long val,double long n); -zp_nothw zp_unseq zp_useres float zp_nrtf( float val,float n); +zp_nothw zp_unseq zp_useres zp_f02 zp_nrtf02(zp_f02 val,zp_f02 n); +zp_nothw zp_unseq zp_useres zp_f04 zp_nrtf04(zp_f04 val,zp_f04 n); /* secant */ -zp_nothw zp_unseq zp_useres double zp_secd( double ang); -zp_nothw zp_unseq zp_useres double long zp_secdl(double long ang); -zp_nothw zp_unseq zp_useres float zp_secf( float ang); +zp_nothw zp_unseq zp_useres zp_f02 zp_secf02(zp_f02 ang); +zp_nothw zp_unseq zp_useres zp_f04 zp_secf04(zp_f04 ang); /* sine */ -zp_nothw zp_unseq zp_useres double zp_sind( double ang); -zp_nothw zp_unseq zp_useres double long zp_sindl(double long ang); -zp_nothw zp_unseq zp_useres float zp_sinf( float ang); +zp_nothw zp_unseq zp_useres zp_f02 zp_sinf02(zp_f02 ang); +zp_nothw zp_unseq zp_useres zp_f04 zp_sinf04(zp_f04 ang); /* square root */ -zp_nothw zp_unseq zp_useres double zp_sqrtd( double val); -zp_nothw zp_unseq zp_useres double long zp_sqrtdl(double long val); -zp_nothw zp_unseq zp_useres float zp_sqrtf( float val); +zp_nothw zp_unseq zp_useres zp_f02 zp_sqrtf02(zp_f02 val); +zp_nothw zp_unseq zp_useres zp_f04 zp_sqrtf04(zp_f04 val); /* tangens */ -zp_nothw zp_unseq zp_useres double zp_tand( double ang); -zp_nothw zp_unseq zp_useres double long zp_tandl(double long ang); -zp_nothw zp_unseq zp_useres float zp_tanf( float ang); +zp_nothw zp_unseq zp_useres zp_f02 zp_tanf02(zp_f02 ang); +zp_nothw zp_unseq zp_useres zp_f04 zp_tanf04(zp_f04 ang); /* "tesseract" (fourth) root */ -zp_nothw zp_unseq zp_useres double zp_tsrtd( double val); -zp_nothw zp_unseq zp_useres double long zp_tsrtdl(double long val); -zp_nothw zp_unseq zp_useres float zp_tsrtf( float val); +zp_nothw zp_unseq zp_useres zp_f02 zp_tsrtf02(zp_f02 val); +zp_nothw zp_unseq zp_useres zp_f04 zp_tsrtf04(zp_f04 val); /* two-space vector addition */ -zp_nothw zp_unseq zp_useres zp_vec2f zp_vadd2f( zp_vec2f lvec,zp_vec2f rvec); -zp_nothw zp_unseq zp_useres zp_vec2d zp_vadd2d( zp_vec2d lvec,zp_vec2d rvec); -zp_nothw zp_unseq zp_useres zp_vec2dl zp_vadd2dl(zp_vec2dl lvec,zp_vec2dl rvec); +zp_nothw zp_unseq zp_useres zp_vec2f02 zp_vadd2f02(zp_vec2f02 lvec,zp_vec2f02 rvec); +zp_nothw zp_unseq zp_useres zp_vec2f04 zp_vadd2f04(zp_vec2f04 lvec,zp_vec2f04 rvec); /* three-space vector addition */ -zp_nothw zp_unseq zp_useres zp_vec3f zp_vadd3f( zp_vec3f lvec,zp_vec3f rvec); -zp_nothw zp_unseq zp_useres zp_vec3d zp_vadd3d( zp_vec3d lvec,zp_vec3d rvec); -zp_nothw zp_unseq zp_useres zp_vec3dl zp_vadd3dl(zp_vec3dl lvec,zp_vec3dl rvec); +zp_nothw zp_unseq zp_useres zp_vec3f02 zp_vadd3f02(zp_vec3f02 lvec,zp_vec3f02 rvec); +zp_nothw zp_unseq zp_useres zp_vec3f04 zp_vadd3f04(zp_vec3f04 lvec,zp_vec3f04 rvec); /* four-space vector addition */ -zp_nothw zp_unseq zp_useres zp_vec4f zp_v4addf( zp_vec4f lvec,zp_vec4f rvec); -zp_nothw zp_unseq zp_useres zp_vec4d zp_v4addd( zp_vec4d lvec,zp_vec4d rvec); -zp_nothw zp_unseq zp_useres zp_vec4dl zp_v4adddl(zp_vec4dl lvec,zp_vec4dl rvec); +zp_nothw zp_unseq zp_useres zp_vec4f02 zp_v4addf02(zp_vec4f02 lvec,zp_vec4f02 rvec); +zp_nothw zp_unseq zp_useres zp_vec4f04 zp_v4addf04(zp_vec4f04 lvec,zp_vec4f04 rvec); /* two-space vector subtraction */ -zp_nothw zp_unseq zp_useres zp_vec2f zp_vsub2f( zp_vec2f lvec,zp_vec2f rvec); -zp_nothw zp_unseq zp_useres zp_vec2d zp_vsub2d( zp_vec2d lvec,zp_vec2d rvec); -zp_nothw zp_unseq zp_useres zp_vec2dl zp_vsub2dl(zp_vec2dl lvec,zp_vec2dl rvec); +zp_nothw zp_unseq zp_useres zp_vec2f02 zp_vsub2f02(zp_vec2f02 lvec,zp_vec2f02 rvec); +zp_nothw zp_unseq zp_useres zp_vec2f04 zp_vsub2f04(zp_vec2f04 lvec,zp_vec2f04 rvec); /* three-space vector subtraction */ -zp_nothw zp_unseq zp_useres zp_vec3f zp_vsub3f( zp_vec3f lvec,zp_vec3f rvec); -zp_nothw zp_unseq zp_useres zp_vec3d zp_vsub3d( zp_vec3d lvec,zp_vec3d rvec); -zp_nothw zp_unseq zp_useres zp_vec3dl zp_vsub3dl(zp_vec3dl lvec,zp_vec3dl rvec); +zp_nothw zp_unseq zp_useres zp_vec3f02 zp_vsub3f02(zp_vec3f02 lvec,zp_vec3f02 rvec); +zp_nothw zp_unseq zp_useres zp_vec3f04 zp_vsub3f04(zp_vec3f04 lvec,zp_vec3f04 rvec); /* four-space vector subtraction */ -zp_nothw zp_unseq zp_useres zp_vec4f zp_v4subf( zp_vec4f lvec,zp_vec4f rvec); -zp_nothw zp_unseq zp_useres zp_vec4d zp_v4subd( zp_vec4d lvec,zp_vec4d rvec); -zp_nothw zp_unseq zp_useres zp_vec4dl zp_v4subdl(zp_vec4dl lvec,zp_vec4dl rvec); +zp_nothw zp_unseq zp_useres zp_vec4f02 zp_v4subf02(zp_vec4f02 lvec,zp_vec4f02 rvec); +zp_nothw zp_unseq zp_useres zp_vec4f04 zp_v4subf04(zp_vec4f04 lvec,zp_vec4f04 rvec); zp_prv_cdeclend diff --git a/zp/include/zp/prv/chr.h b/zp/include/zp/prv/chr.h index 5de5aa8..acac733 100644 --- a/zp/include/zp/prv/chr.h +++ b/zp/include/zp/prv/chr.h @@ -80,18 +80,18 @@ typedef char8_t zp_c8; typedef char unsigned zp_c8; #endif -#define zp_minvalc01 ((zp_c01)+zp_minvali01m) -#define zp_maxvalc01 ((zp_c01)+zp_maxvali01m) +#define zp_minvalc01 ((zp_c01)+zp_minvali01) +#define zp_maxvalc01 ((zp_c01)+zp_maxvali01) #ifdef zp_std_cxx11 typedef char16_t zp_c01; #else -typedef zp_i01m zp_c01; +typedef zp_i01 zp_c01; #endif -#define zp_minvalc02 ((zp_c02)+zp_minvali02m) -#define zp_maxvalc02 ((zp_c02)+zp_maxvali02m) +#define zp_minvalc02 ((zp_c02)+zp_minvali02) +#define zp_maxvalc02 ((zp_c02)+zp_maxvali02) #ifdef zp_std_cxx11 typedef char32_t zp_c02; #else -typedef zp_i02m zp_c02; +typedef zp_i02 zp_c02; #endif diff --git a/zp/include/zp/prv/flt.h b/zp/include/zp/prv/flt.h index 91a2db9..373e480 100644 --- a/zp/include/zp/prv/flt.h +++ b/zp/include/zp/prv/flt.h @@ -8,12 +8,8 @@ On platforms that support them, we define fixed- width IEEE floating-point types: - f01 ::std::float16_t binary16, fraction: 10 exponent: 5 sign:1 f02 ::std::float32_t binary32, fraction: 23 exponent: 8 sign:1 f04 ::std::float64_t binary64, fraction: 52 exponent:11 sign:1 - f08 ::std::float128_t binary128, fraction:112 exponent:15 sign:1 - f001 binary256, fraction:236 exponent:19 sign:1 - ... There are equivalent to the ISO C and the C++ types in stdfloat, with some minor differences, @@ -80,88 +76,48 @@ #endif -#define zp_fixflt02 (0x1) #define zp_minvalf02 zp_minvalf #define zp_maxvalf02 zp_maxvalf -typedef float zp_prv_f02; +typedef float zp_f02; -#define zp_fixflt04 (0x1) #define zp_minvalf04 zp_minvald #define zp_maxvalf04 zp_maxvald -typedef double zp_prv_f04; +typedef double zp_f04; -#if \ - zp_arc_arm64 /* x86 jealous :( */ - -#define zp_fixflt08 (0x1) -typedef double long zp_prv_f08; - -#elif \ - __FLOAT128__ \ -|| __SIZEOF_FLOAT128__ - -#define zp_fixflt08 (0x1) -zp_prv_ext typedef __float128 zp_prv_f08; - -#endif - -#if zp_std_c - -#if zp_fixflt01 -typedef zp_prv_f01 zp_f01; -#endif -#if zp_fixflt02 -typedef zp_prv_f02 zp_f02; +#if zp_prv_hasbltin(__builtin_nan) +#define zp_nand (__builtin_nan("")) +#else +#define zp_nand (0.0); #endif -#if zp_fixflt04 -typedef zp_prv_f04 zp_f04; +#if zp_prv_hasbltin(__builtin_nanf) +#define zp_nanf (__builtin_nanf("")) +#else +#define zp_nanf (0.0f); #endif -#if zp_fixflt08 -typedef zp_prv_f08 zp_f08; +#if zp_prv_hasbltin(__builtin_nanl) +#define zp_nanld (__builtin_nanl("")) +#else +#define zp_nanld (0.0l); #endif -#elif zp_std_cxx -#if zp_fixflt01 - -typedef zp_prv_f01 zp_f01; - -#elif __STDCPP_FLOAT16_T__ - -#define zp_fixflt01 (0x1) -typedef decltype (0.0f16) zp_f01; - +#if zp_prv_hasbltin(__builtin_huge_val) +#define zp_infd (__builtin_huge_val()) +#else +#define zp_infd (zp_maxvald) #endif - -#if zp_fixflt02 - -typedef zp_prv_f02 zp_f02; - -#elif __STDCPP_FLOAT32_T__ - -#define zp_fixflt02 (0x1) -typedef decltype (0.0f32) zp_f02; - +#if zp_prv_hasbltin(__builtin_huge_valf) +#define zp_inff (__builtin_huge_valf()) +#else +#define zp_inff (zp_maxvalf) #endif - -#if zp_fixflt04 - -typedef zp_prv_f04 zp_f04; - -#elif __STDCPP_FLOAT64_T__ - -#define zp_fixflt04 (0x1) -typedef decltype (0.0f64) zp_f04; - +#if zp_prv_hasbltin(__builtin_huge_vall) +#define zp_infld (__builtin_huge_vall()) +#else +#define zp_infld (zp_maxvaldl) #endif -#if zp_fixflt08 - -typedef zp_prv_f08 zp_f08; +#define zp_nanf02 (zp_nanf) +#define zp_nanf04 (zp_nand) -#elif __STDCPP_FLOAT128_T__ - -#define zp_fixflt08 (0x1) -typedef decltype (0.0f128) zp_f08; - -#endif -#endif +#define zp_inff02 (zp_inff) +#define zp_inff04 (zp_infd) diff --git a/zp/include/zp/prv/int.h b/zp/include/zp/prv/int.h index 87d7166..6ac4243 100644 --- a/zp/include/zp/prv/int.h +++ b/zp/include/zp/prv/int.h @@ -5,20 +5,8 @@ */ /* - We define the following minimum-width integral + We define the following fixed-width integral types as replacmenets for the standard types: - - i8m uint_least8_t - i8ms uint_least8_t - i01m uint_least16_t - i01ms uint_least16_t - i02m uint_least32_t - i02ms uint_least32_t - i04m uint_least64_t - i04ms uint_least64_t - - We likewise define the following fixed-width - integral types (if supported): i8 uint8_t i8s uint8_t @@ -76,7 +64,6 @@ #define zp_minvalp ((zp_intptr)+0x0u) #define zp_minvalz ((zp_siz) +0x0u) -#define zp_fixint8 (0x1) #define zp_minvali8 zp_minvalcu #define zp_minvali8s zp_minvalcs #define zp_maxvali8 zp_maxvalcu @@ -84,7 +71,6 @@ typedef char unsigned zp_i8; typedef char signed zp_i8s; -#define zp_fixint01 (0x1) #define zp_minvali01 zp_minvalsu #define zp_minvali01s zp_minvals #define zp_maxvali01 zp_maxvalsu @@ -97,7 +83,6 @@ typedef short zp_i01s; /* For some reason long. */ -#define zp_fixint02 (0x1) #define zp_minvali02 zp_minvallu #define zp_minvali02s zp_minvall #define zp_maxvali02 zp_maxvallu @@ -107,7 +92,6 @@ typedef long zp_i02s; #else -#define zp_fixint02 (0x1) #define zp_minvali02 zp_minvaliu #define zp_minvali02s zp_minvali #define zp_maxvali02 zp_maxvaliu @@ -117,27 +101,6 @@ typedef int zp_i02s; #endif -#define zp_minvali8m zp_minvali8 -#define zp_minvali8ms zp_minvali8s -#define zp_maxvali8m zp_maxvali8 -#define zp_maxvali8ms zp_maxvali8s -typedef zp_i8 zp_i8m; -typedef zp_i8s zp_i8ms; - -#define zp_minvali01m zp_minvali01 -#define zp_minvali01ms zp_minvali01s -#define zp_maxvali01m zp_maxvali01 -#define zp_maxvali01ms zp_maxvali01s -typedef zp_i01 zp_i01m; -typedef zp_i01s zp_i01ms; - -#define zp_minvali02m zp_minvali02 -#define zp_minvali02ms zp_minvali02s -#define zp_maxvali02m zp_maxvali02 -#define zp_maxvali02ms zp_maxvali02s -typedef zp_i02 zp_i02m; -typedef zp_i02s zp_i02ms; - #if \ zp_sys_dos @@ -145,7 +108,6 @@ typedef zp_i02s zp_i02ms; #define zp_maxvallu ((long unsigned)+0xFFFFFFFFllu) #define zp_maxvall ((long) +0x7FFFFFFFll) -#define zp_fixint04 (0x1) #define zp_minvali04 zp_minvalllu #define zp_minvali04s zp_minvalll #define zp_maxvali04 zp_maxvalllu @@ -153,13 +115,6 @@ typedef zp_i02s zp_i02ms; typedef long long unsigned zp_i04; typedef long long zp_i04s; -#define zp_minvali04m zp_minval04 -#define zp_minvali04ms zp_minval04s -#define zp_maxvali04m zp_maxval04 -#define zp_maxvali04ms zp_maxval04s -typedef zp_i04 zp_i04m; -typedef zp_i04s zp_i04ms; - #else #if \ zp_arc_amd64 \ @@ -169,7 +124,6 @@ typedef zp_i04s zp_i04ms; #define zp_maxvallu ((long unsigned)+0xFFFFFFFFFFFFFFFFlu) #define zp_maxvall ((long) +0x7FFFFFFFFFFFFFFFl) -#define zp_fixint04 (0x1) #define zp_minvali04 zp_minvallu #define zp_minvali04s zp_minvall #define zp_maxvali04 zp_maxvallu @@ -177,13 +131,6 @@ typedef zp_i04s zp_i04ms; typedef long unsigned zp_i04; typedef long zp_i04s; -#define zp_minvali04m zp_minval04 -#define zp_minvali04ms zp_minval04s -#define zp_maxvali04m zp_maxval04 -#define zp_maxvali04ms zp_maxval04s -typedef zp_i04 zp_i04m; -typedef zp_i04s zp_i04ms; - #elif \ zp_arc_arm \ || zp_arc_ia32 @@ -192,7 +139,6 @@ typedef zp_i04s zp_i04ms; #define zp_maxvallu ((long unsigned)+0xFFFFFFFFllu) #define zp_maxvall ((long) +0x7FFFFFFFll) -#define zp_fixint04 (0x1) #define zp_minvali04 zp_minvalllu #define zp_minvali04s zp_minvalll #define zp_maxvali04 zp_maxvalllu @@ -200,24 +146,7 @@ typedef zp_i04s zp_i04ms; typedef long long unsigned zp_i04; typedef long long zp_i04s; -#define zp_minvali04m zp_minval04 -#define zp_minvali04ms zp_minval04s -#define zp_maxvali04m zp_maxval04 -#define zp_maxvali04ms zp_maxval04s -typedef zp_i04 zp_i04m; -typedef zp_i04s zp_i04ms; - -#endif #endif - -#if \ - __INT128__ /* Not defined by any compiler that I know, but Clang does define __FLOAT128__. */ \ -|| __SIZEOF_INT128__ - -#define zp_fixint08 (0x1) -zp_prv_ext typedef __int128 unsigned zp_i08; -zp_prv_ext typedef __int128 zp_i08s; - #endif #if \ @@ -246,8 +175,6 @@ typedef long long unsigned zp_intptr; #define zp_maxvalz ((zp_siz)+zp_maxvalllu) typedef long long unsigned zp_siz; -#else -#error unable to implement types: calling convention uses long long, but no equivalent is supported #endif #else diff --git a/zp/include/zp/str b/zp/include/zp/str index 0e7cf0f..d04350e 100644 --- a/zp/include/zp/str +++ b/zp/include/zp/str @@ -12,7 +12,7 @@ namespace zp { namespace prv { - template<typename typ> zp_nothw zp_useres ::zp::siz numdig(typ val,::zp::i8m bs); + template<typename typ> zp_nothw zp_useres ::zp::siz numdig(typ val,::zp::i8 bs); } zp_iln zp_nothw inline ::zp::siz strcpy(char * dst, char const * src) {return ::zp_strcpy(dst,src);} @@ -48,9 +48,9 @@ namespace zp { zp_iln zp_nothw inline void win1252enc(::zp::c8 * dst,::zp::c02 const * src) {return ::zp_win1252enc(dst,src);} zp_iln zp_nothw inline void win1252dec(::zp::c02 * dst,::zp::c8 const * src) {return ::zp_win1252dec(dst,src);} - //template<typename typ> zp_nothw zp_useres ::zp::siz fmtlen(typ val,::zp::i8m bs); /* Including (potential) decorations. */ + //template<typename typ> zp_nothw zp_useres ::zp::siz fmtlen(typ val,::zp::i8 bs); /* Including (potential) decorations. */ - //template<typename typ> zp_nothw void fmt(::zp::c02 * buf,typ val,::zp::i8m bs,bool rtl = false); + //template<typename typ> zp_nothw void fmt(::zp::c02 * buf,typ val,::zp::i8 bs,bool rtl = false); } #include <zp/imp/str.ii> diff --git a/zp/include/zp/str.h b/zp/include/zp/str.h index ba51f5f..c656538 100644 --- a/zp/include/zp/str.h +++ b/zp/include/zp/str.h @@ -41,30 +41,30 @@ zp_nothw void zp_utf16dec( zp_c02 * dst,zp_c01 const * src); zp_nothw void zp_win1252enc(zp_c8 * dst,zp_c02 const * src); zp_nothw void zp_win1252dec(zp_c02 * dst,zp_c8 const * src); -zp_nothw zp_useres zp_siz zp_fmtleni( int val,zp_i8m bs); -zp_nothw zp_useres zp_siz zp_fmtlenl( long val,zp_i8m bs); -zp_nothw zp_useres zp_siz zp_fmtlens( short val,zp_i8m bs); -zp_nothw zp_useres zp_siz zp_fmtlensc( char signed val,zp_i8m bs); -zp_nothw zp_useres zp_siz zp_fmtlenuc( char unsigned val,zp_i8m bs); -zp_nothw zp_useres zp_siz zp_fmtlenui( int unsigned val,zp_i8m bs); -zp_nothw zp_useres zp_siz zp_fmtlenul( long unsigned val,zp_i8m bs); -zp_nothw zp_useres zp_siz zp_fmtlenus( short unsigned val,zp_i8m bs); +zp_nothw zp_useres zp_siz zp_fmtleni( int val,zp_i8 bs); +zp_nothw zp_useres zp_siz zp_fmtlenl( long val,zp_i8 bs); +zp_nothw zp_useres zp_siz zp_fmtlens( short val,zp_i8 bs); +zp_nothw zp_useres zp_siz zp_fmtlensc( char signed val,zp_i8 bs); +zp_nothw zp_useres zp_siz zp_fmtlenuc( char unsigned val,zp_i8 bs); +zp_nothw zp_useres zp_siz zp_fmtlenui( int unsigned val,zp_i8 bs); +zp_nothw zp_useres zp_siz zp_fmtlenul( long unsigned val,zp_i8 bs); +zp_nothw zp_useres zp_siz zp_fmtlenus( short unsigned val,zp_i8 bs); #if zp_std_c99 || zp_std_cxx11 -zp_nothw zp_useres zp_siz zp_fmtlenll( long long val,zp_i8m bs); -zp_nothw zp_useres zp_siz zp_fmtlenull(long long unsigned val,zp_i8m bs); +zp_nothw zp_useres zp_siz zp_fmtlenll( long long val,zp_i8 bs); +zp_nothw zp_useres zp_siz zp_fmtlenull(long long unsigned val,zp_i8 bs); #endif -zp_nothw void zp_fmti( zp_c02 * buf,int val,zp_i8m bs,bool rtl); -zp_nothw void zp_fmtl( zp_c02 * buf,long val,zp_i8m bs,bool rtl); -zp_nothw void zp_fmts( zp_c02 * buf,short val,zp_i8m bs,bool rtl); -zp_nothw void zp_fmtsc( zp_c02 * buf,char signed val,zp_i8m bs,bool rtl); -zp_nothw void zp_fmtuc( zp_c02 * buf,char unsigned val,zp_i8m bs,bool rtl); -zp_nothw void zp_fmtui( zp_c02 * buf,int unsigned val,zp_i8m bs,bool rtl); -zp_nothw void zp_fmtul( zp_c02 * buf,long unsigned val,zp_i8m bs,bool rtl); -zp_nothw void zp_fmtus( zp_c02 * buf,short unsigned val,zp_i8m bs,bool rtl); +zp_nothw void zp_fmti( zp_c02 * buf,int val,zp_i8 bs,bool rtl); +zp_nothw void zp_fmtl( zp_c02 * buf,long val,zp_i8 bs,bool rtl); +zp_nothw void zp_fmts( zp_c02 * buf,short val,zp_i8 bs,bool rtl); +zp_nothw void zp_fmtsc( zp_c02 * buf,char signed val,zp_i8 bs,bool rtl); +zp_nothw void zp_fmtuc( zp_c02 * buf,char unsigned val,zp_i8 bs,bool rtl); +zp_nothw void zp_fmtui( zp_c02 * buf,int unsigned val,zp_i8 bs,bool rtl); +zp_nothw void zp_fmtul( zp_c02 * buf,long unsigned val,zp_i8 bs,bool rtl); +zp_nothw void zp_fmtus( zp_c02 * buf,short unsigned val,zp_i8 bs,bool rtl); #if zp_std_c99 || zp_std_cxx11 -zp_nothw void zp_fmtll( zp_c02 * buf,long long val,zp_i8m bs,bool rtl); -zp_nothw void zp_fmtull(zp_c02 * buf,long long unsigned val,zp_i8m bs,bool rtl); +zp_nothw void zp_fmtll( zp_c02 * buf,long long val,zp_i8 bs,bool rtl); +zp_nothw void zp_fmtull(zp_c02 * buf,long long unsigned val,zp_i8 bs,bool rtl); #endif zp_prv_cdeclend diff --git a/zp/include/zp/zp b/zp/include/zp/zp index 977be42..6724c54 100644 --- a/zp/include/zp/zp +++ b/zp/include/zp/zp @@ -30,59 +30,21 @@ #endif namespace zp { - typedef ::zp_i8m i8m; - typedef ::zp_i8ms i8ms; - - typedef ::zp_i01m i01m; - typedef ::zp_i01ms i01ms; - - typedef ::zp_i02m i02m; - typedef ::zp_i02ms i02ms; - - typedef ::zp_i04m i04m; - typedef ::zp_i04ms i04ms; - -#if zp_fixint8 typedef ::zp_i8 i8; typedef ::zp_i8s i8s; -#endif -#if zp_fixint01 + typedef ::zp_i01 i01; typedef ::zp_i01s i01s; -#endif -#if zp_fixint02 + typedef ::zp_i02 i02; typedef ::zp_i02s i02s; -#endif -#if zp_fixint04 + typedef ::zp_i04 i04; typedef ::zp_i04s i04s; -#endif -#if zp_fixint08 - typedef ::zp_i08 i08; - typedef ::zp_i08s i08s; -#endif -#if zp_fixint08 - typedef ::zp_i08 i08; - typedef ::zp_i08s i08s; -#endif typedef ::zp_intptr intptr; typedef ::zp_siz siz; -#if zp_fixflt01 - typedef ::zp_f01 f01; -#endif -#if zp_fixflt02 - typedef ::zp_f02 f02; -#endif -#if zp_fixflt04 - typedef ::zp_f04 f04; -#endif -#if zp_fixflt08 - typedef ::zp_f08 f08; -#endif - typedef ::zp_wchr wchr; typedef ::zp_c8 c8; typedef ::zp_c01 c01; @@ -91,6 +53,9 @@ namespace zp { typedef ::zp_syscalidt syscalidt; typedef ::zp_syscalres syscalres; + typedef ::zp_f02 f02; + typedef ::zp_f04 f04; + #if zp_std_cxx11 using nulptrtyp = ::zp_nulptrtyp; #endif @@ -321,6 +286,18 @@ namespace zp { template<typename typ> struct ischrtyp<typ const> {constexpr static bool val = ischrtyp<typ>::val;}; template<typename typ> struct ischrtyp<typ volatile> {constexpr static bool val = ischrtyp<typ>::val;}; template<typename typ> struct ischrtyp<typ const volatile> {constexpr static bool val = ischrtyp<typ>::val;}; + + template<typename typ> struct nan {constexpr static typ val = typ {0x0};}; + + template<> struct nan<double> {constexpr static double const val = zp_nanf;}; + template<> struct nan<double long> {constexpr static double long const val = zp_nanld;}; + template<> struct nan<float> {constexpr static float const val = zp_nand;}; + + template<typename typ> struct inf {constexpr static typ val = ::zp::maxval<typ>::val;}; + + template<> struct inf<double> {constexpr static double const val = zp_inff;}; + template<> struct inf<double long> {constexpr static double long const val = zp_infld;}; + template<> struct inf<float> {constexpr static float const val = zp_infd;}; #endif // c++11 #if zp_std_cxx20 @@ -330,14 +307,40 @@ namespace zp { template<typename typ> concept inttyp = ::zp::isinttyp<typ>::val; #endif +#if zp_std_cxx11 + namespace det { + struct nulopt {}; + } + + constexpr ::zp::det::nulopt nulopt = {}; + + template<typename typ> class opt { + public: + constexpr opt(::zp::det::nulopt) noexcept; + constexpr opt(typ const & val) noexcept; + + constexpr auto chk() const noexcept -> bool; + + constexpr auto val() const noexcept -> typ; + + template<typename funtyp,typename msgtyp> auto exp(funtyp const & fun,msgtyp const & msg) const -> typ; + + constexpr auto operator = (typ const & val) noexcept -> ::zp::opt<typ>; + + private: + bool hasval; + typ valval; + }; +#endif + namespace det { - template<typename typ> struct vertyp { + template<typename typ> struct ver { typ api; typ ext; }; } - zp_prv_trtval (::zp::det::vertyp< ::zp::i04>) ver = {zp_apiver,zp_extver}; + zp_prv_trtval (::zp::det::ver< ::zp::i04>) ver = {zp_apiver,zp_extver}; zp_prv_trtval (::zp::siz) bytelen = zp_bytelen; @@ -350,7 +353,7 @@ namespace zp { #endif zp_iln zp_noret zp_nothw inline void trp() {::zp_trp();} - zp_iln zp_noret zp_nothw inline void urch() {zp_unrch();} + zp_iln zp_noret zp_nothw inline void unrch() {zp_unrch();} #if zp_std_cxx11 // We cannot use template parameter packs before C++11, so this function becomes quite non-trivial to implement. template<typename... typs> zp_iln inline auto syscal(::zp::syscalidt idt,typs const &... args) -> ::zp::syscalres {return ::zp_syscal(idt,args...);} diff --git a/zp/include/zp/zp.h b/zp/include/zp/zp.h index e6c7580..5f290d6 100644 --- a/zp/include/zp/zp.h +++ b/zp/include/zp/zp.h @@ -58,7 +58,7 @@ signaling non-standard changes (such as the sign of char). - - For features (such as urch), we look for a + - For features (such as unrch), we look for a generic indicator (such as __has_builtin) before determening if we can implement it. Otherwise, we look at the compiler. Otherwise, @@ -275,8 +275,8 @@ typedef typeof (nullptr) zp_nulptrtyp; typedef decltype (nullptr) zp_nulptrtyp; #endif -#define zp_apiver ((zp_i04m)+0x1u) /* Programs expecting this version will still compile with the current extension version. */ -#define zp_extver ((zp_i04m)+0x0u) /* The extension versions adds functionality without breaking the existing ones. */ +#define zp_apiver ((zp_i04)+0x1u) /* Programs expecting this version will still compile with the current extension version. */ +#define zp_extver ((zp_i04)+0x0u) /* The extension versions adds functionality without breaking the existing ones. */ /* The patch version is not public as it only changes implementation details. */ #define zp_bytelen ((zp_siz)+0x8u) diff --git a/zp/source/any/str/fmt.cc b/zp/source/any/str/fmt.cc index 4edb623..49d1bfd 100644 --- a/zp/source/any/str/fmt.cc +++ b/zp/source/any/str/fmt.cc @@ -7,14 +7,14 @@ #include <zp/str> /*extern "C" { - zp_nothw auto zp_fmti( char32_t * const buf,int const val,::zp::i8m const bs,bool const rtl) -> void {return ::zp::fmt(buf,val,bs,rtl);} - zp_nothw auto zp_fmtl( char32_t * const buf,long const val,::zp::i8m const bs,bool const rtl) -> void {return ::zp::fmt(buf,val,bs,rtl);} - zp_nothw auto zp_fmtll( char32_t * const buf,long long const val,::zp::i8m const bs,bool const rtl) -> void {return ::zp::fmt(buf,val,bs,rtl);} - zp_nothw auto zp_fmts( char32_t * const buf,short const val,::zp::i8m const bs,bool const rtl) -> void {return ::zp::fmt(buf,val,bs,rtl);} - zp_nothw auto zp_fmtsc( char32_t * const buf,char signed const val,::zp::i8m const bs,bool const rtl) -> void {return ::zp::fmt(buf,val,bs,rtl);} - zp_nothw auto zp_fmtuc( char32_t * const buf,char unsigned const val,::zp::i8m const bs,bool const rtl) -> void {return ::zp::fmt(buf,val,bs,rtl);} - zp_nothw auto zp_fmtui( char32_t * const buf,int unsigned const val,::zp::i8m const bs,bool const rtl) -> void {return ::zp::fmt(buf,val,bs,rtl);} - zp_nothw auto zp_fmtul( char32_t * const buf,long unsigned const val,::zp::i8m const bs,bool const rtl) -> void {return ::zp::fmt(buf,val,bs,rtl);} - zp_nothw auto zp_fmtull(char32_t * const buf,long long unsigned const val,::zp::i8m const bs,bool const rtl) -> void {return ::zp::fmt(buf,val,bs,rtl);} - zp_nothw auto zp_fmtus( char32_t * const buf,short unsigned const val,::zp::i8m const bs,bool const rtl) -> void {return ::zp::fmt(buf,val,bs,rtl);} + zp_nothw auto zp_fmti( char32_t * const buf,int const val,::zp::i8 const bs,bool const rtl) -> void {return ::zp::fmt(buf,val,bs,rtl);} + zp_nothw auto zp_fmtl( char32_t * const buf,long const val,::zp::i8 const bs,bool const rtl) -> void {return ::zp::fmt(buf,val,bs,rtl);} + zp_nothw auto zp_fmtll( char32_t * const buf,long long const val,::zp::i8 const bs,bool const rtl) -> void {return ::zp::fmt(buf,val,bs,rtl);} + zp_nothw auto zp_fmts( char32_t * const buf,short const val,::zp::i8 const bs,bool const rtl) -> void {return ::zp::fmt(buf,val,bs,rtl);} + zp_nothw auto zp_fmtsc( char32_t * const buf,char signed const val,::zp::i8 const bs,bool const rtl) -> void {return ::zp::fmt(buf,val,bs,rtl);} + zp_nothw auto zp_fmtuc( char32_t * const buf,char unsigned const val,::zp::i8 const bs,bool const rtl) -> void {return ::zp::fmt(buf,val,bs,rtl);} + zp_nothw auto zp_fmtui( char32_t * const buf,int unsigned const val,::zp::i8 const bs,bool const rtl) -> void {return ::zp::fmt(buf,val,bs,rtl);} + zp_nothw auto zp_fmtul( char32_t * const buf,long unsigned const val,::zp::i8 const bs,bool const rtl) -> void {return ::zp::fmt(buf,val,bs,rtl);} + zp_nothw auto zp_fmtull(char32_t * const buf,long long unsigned const val,::zp::i8 const bs,bool const rtl) -> void {return ::zp::fmt(buf,val,bs,rtl);} + zp_nothw auto zp_fmtus( char32_t * const buf,short unsigned const val,::zp::i8 const bs,bool const rtl) -> void {return ::zp::fmt(buf,val,bs,rtl);} }*/ diff --git a/zp/source/any/str/fmtlen.cc b/zp/source/any/str/fmtlen.cc index 1f281a8..ec678a4 100644 --- a/zp/source/any/str/fmtlen.cc +++ b/zp/source/any/str/fmtlen.cc @@ -8,14 +8,14 @@ #include <zp/str> /* extern "C" { - zp_nothw auto zp_fmtleni( int const val,::zp::i8m const bs) -> ::zp::siz {return ::zp::fmtlen(val,bs);} - zp_nothw auto zp_fmtlenl( long const val,::zp::i8m const bs) -> ::zp::siz {return ::zp::fmtlen(val,bs);} - zp_nothw auto zp_fmtlenll( long long const val,::zp::i8m const bs) -> ::zp::siz {return ::zp::fmtlen(val,bs);} - zp_nothw auto zp_fmtlens( short const val,::zp::i8m const bs) -> ::zp::siz {return ::zp::fmtlen(val,bs);} - zp_nothw auto zp_fmtlensc( char signed const val,::zp::i8m const bs) -> ::zp::siz {return ::zp::fmtlen(val,bs);} - zp_nothw auto zp_fmtlenuc( char unsigned const val,::zp::i8m const bs) -> ::zp::siz {return ::zp::fmtlen(val,bs);} - zp_nothw auto zp_fmtlenui( int unsigned const val,::zp::i8m const bs) -> ::zp::siz {return ::zp::fmtlen(val,bs);} - zp_nothw auto zp_fmtlenul( long unsigned const val,::zp::i8m const bs) -> ::zp::siz {return ::zp::fmtlen(val,bs);} - zp_nothw auto zp_fmtlenull(long long unsigned const val,::zp::i8m const bs) -> ::zp::siz {return ::zp::fmtlen(val,bs);} - zp_nothw auto zp_fmtlenus( short unsigned const val,::zp::i8m const bs) -> ::zp::siz {return ::zp::fmtlen(val,bs);} + zp_nothw auto zp_fmtleni( int const val,::zp::i8 const bs) -> ::zp::siz {return ::zp::fmtlen(val,bs);} + zp_nothw auto zp_fmtlenl( long const val,::zp::i8 const bs) -> ::zp::siz {return ::zp::fmtlen(val,bs);} + zp_nothw auto zp_fmtlenll( long long const val,::zp::i8 const bs) -> ::zp::siz {return ::zp::fmtlen(val,bs);} + zp_nothw auto zp_fmtlens( short const val,::zp::i8 const bs) -> ::zp::siz {return ::zp::fmtlen(val,bs);} + zp_nothw auto zp_fmtlensc( char signed const val,::zp::i8 const bs) -> ::zp::siz {return ::zp::fmtlen(val,bs);} + zp_nothw auto zp_fmtlenuc( char unsigned const val,::zp::i8 const bs) -> ::zp::siz {return ::zp::fmtlen(val,bs);} + zp_nothw auto zp_fmtlenui( int unsigned const val,::zp::i8 const bs) -> ::zp::siz {return ::zp::fmtlen(val,bs);} + zp_nothw auto zp_fmtlenul( long unsigned const val,::zp::i8 const bs) -> ::zp::siz {return ::zp::fmtlen(val,bs);} + zp_nothw auto zp_fmtlenull(long long unsigned const val,::zp::i8 const bs) -> ::zp::siz {return ::zp::fmtlen(val,bs);} + zp_nothw auto zp_fmtlenus( short unsigned const val,::zp::i8 const bs) -> ::zp::siz {return ::zp::fmtlen(val,bs);} } */ |