diff options
61 files changed, 544 insertions, 567 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt index a01c9c8..79a8d04 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -75,6 +75,13 @@ * Fix wrong symbols; +* Support C++11; +* Make constexpr conditional; +* Use raw metaprogramming classes; +* Remove specialisations for nulptrtyp; +* Rename private namespace: priv => prv; +* Rename isarith to isari; + # 0.0.2 * Migrate to CMake; @@ -22,9 +22,9 @@ int main() { char const * const rtypnm = typeid (rtyp).name(); auto const getval = []<typename typ>(typ const & valref) { - if constexpr (::zp::ischr<typ>) {return static_cast<::zp::i02m>(valref);} - else if constexpr (::zp::isptr<typ>) {return reinterpret_cast<void *>(valref);} - else {return valref;} + if constexpr (::zp::ischr<typ>::val) {return static_cast<::zp::i02m>(valref);} + else if constexpr (::zp::isptr<typ>::val) {return reinterpret_cast<void *>(valref);} + else {return valref;} }; auto const lval = getval(lvalref); @@ -8,128 +8,131 @@ int main() { static_assert([] { - static_assert(::zp::isptr<int> == false); - static_assert(::zp::isptr<int *> == true); - static_assert(::zp::isptr<int const *> == true); - static_assert(::zp::isptr<int volatile *> == true); - static_assert(::zp::isptr<int const volatile *> == true); - static_assert(::zp::isptr<int * const> == true); - static_assert(::zp::isptr<int const * const> == true); - static_assert(::zp::isptr<int volatile * const> == true); - static_assert(::zp::isptr<int const volatile * const> == true); - static_assert(::zp::isptr<int * volatile> == true); - static_assert(::zp::isptr<int const * volatile> == true); - static_assert(::zp::isptr<int volatile * volatile> == true); - static_assert(::zp::isptr<int const volatile * volatile> == true); - static_assert(::zp::isptr<int * const volatile> == true); - static_assert(::zp::isptr<int const * const volatile> == true); - static_assert(::zp::isptr<int volatile * const volatile> == true); - static_assert(::zp::isptr<int const volatile * const volatile> == true); + static_assert(::zp::isptr<int>::val == false); + static_assert(::zp::isptr<int *>::val == true); + static_assert(::zp::isptr<int const *>::val == true); + static_assert(::zp::isptr<int volatile *>::val == true); + static_assert(::zp::isptr<int const volatile *>::val == true); + static_assert(::zp::isptr<int * const>::val == true); + static_assert(::zp::isptr<int const * const>::val == true); + static_assert(::zp::isptr<int volatile * const>::val == true); + static_assert(::zp::isptr<int const volatile * const>::val == true); + static_assert(::zp::isptr<int * volatile>::val == true); + static_assert(::zp::isptr<int const * volatile>::val == true); + static_assert(::zp::isptr<int volatile * volatile>::val == true); + static_assert(::zp::isptr<int const volatile * volatile>::val == true); + static_assert(::zp::isptr<int * const volatile>::val == true); + static_assert(::zp::isptr<int const * const volatile>::val == true); + static_assert(::zp::isptr<int volatile * const volatile>::val == true); + static_assert(::zp::isptr<int const volatile * const volatile>::val == true); - static_assert(::zp::typequ<::zp::sgn<int>, int> == true); - static_assert(::zp::typequ<::zp::sgn<int unsigned>,int> == true); + static_assert(::zp::typequ<int,int>::val == true); + static_assert(::zp::typequ<int,long>::val == false); - static_assert(::zp::typequ<::zp::usgn<int unsigned>,int unsigned> == true); - static_assert(::zp::typequ<::zp::usgn<int>, int unsigned> == true); + static_assert(::zp::typequ<::zp::sgn<int>::typ, int>::val == true); + static_assert(::zp::typequ<::zp::sgn<int unsigned>::typ,int>::val == true); - static_assert(::zp::typequ<::zp::remqual<int volatile>, int> == true); - static_assert(::zp::typequ<::zp::remqual<int const volatile>,int> == true); + static_assert(::zp::typequ<::zp::usgn<int unsigned>::typ,int unsigned>::val == true); + static_assert(::zp::typequ<::zp::usgn<int>::typ, int unsigned>::val == true); - static_assert(::zp::typequ<::zp::remqual<int>, int> == true); - static_assert(::zp::typequ<::zp::remqual<int const>, int> == true); - static_assert(::zp::typequ<::zp::remqual<int volatile>, int> == true); - static_assert(::zp::typequ<::zp::remqual<int const volatile>,int> == true); + static_assert(::zp::typequ<::zp::remqual<int volatile>::typ, int>::val == true); + static_assert(::zp::typequ<::zp::remqual<int const volatile>::typ,int>::val == true); + + static_assert(::zp::typequ<::zp::remqual<int>::typ, int>::val == true); + static_assert(::zp::typequ<::zp::remqual<int const>::typ, int>::val == true); + static_assert(::zp::typequ<::zp::remqual<int volatile>::typ, int>::val == true); + static_assert(::zp::typequ<::zp::remqual<int const volatile>::typ,int>::val == true); - static_assert(::zp::typequ<::zp::nulptrtyp,::std::nullptr_t> == true); + static_assert(::zp::typequ<::zp::nulptrtyp,::std::nullptr_t>::val == true); - static_assert(::zp::typequ<::zp::i8m, ::std::uint_least8_t> == true); - static_assert(::zp::typequ<::zp::i8ms, ::std::int_least8_t> == true); - static_assert(::zp::typequ<::zp::i01m, ::std::uint_least16_t> == true); - static_assert(::zp::typequ<::zp::i01ms,::std::int_least16_t> == true); - static_assert(::zp::typequ<::zp::i02m, ::std::uint_least32_t> == true); - static_assert(::zp::typequ<::zp::i02ms,::std::int_least32_t> == true); - static_assert(::zp::typequ<::zp::i04m, ::std::uint_least64_t> == true); - static_assert(::zp::typequ<::zp::i04ms,::std::int_least64_t> == true); + 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::intptr,::std::uintptr_t> == true); - static_assert(::zp::typequ<::zp::sz, ::std::size_t> == true); + static_assert(::zp::typequ<::zp::intptr,::std::uintptr_t>::val == true); + static_assert(::zp::typequ<::zp::sz, ::std::size_t>::val == true); - static_assert(::zp::isusgn<char> == ::std::is_unsigned_v<char>); - static_assert(::zp::isusgn<char16_t> == ::std::is_unsigned_v<char16_t>); - static_assert(::zp::isusgn<char32_t> == ::std::is_unsigned_v<char32_t>); - static_assert(::zp::isusgn<char8_t> == ::std::is_unsigned_v<char8_t>); - static_assert(::zp::isusgn<double> == ::std::is_unsigned_v<double>); - static_assert(::zp::isusgn<float> == ::std::is_unsigned_v<float>); - static_assert(::zp::isusgn<int> == ::std::is_unsigned_v<int>); - static_assert(::zp::isusgn<long> == ::std::is_unsigned_v<long>); - static_assert(::zp::isusgn<long double> == ::std::is_unsigned_v<long double>); - static_assert(::zp::isusgn<long long> == ::std::is_unsigned_v<long long>); - static_assert(::zp::isusgn<short> == ::std::is_unsigned_v<short>); - static_assert(::zp::isusgn<char signed> == ::std::is_unsigned_v<char signed>); - static_assert(::zp::isusgn<char unsigned> == ::std::is_unsigned_v<char unsigned>); - static_assert(::zp::isusgn<int unsigned> == ::std::is_unsigned_v<int unsigned>); - static_assert(::zp::isusgn<long unsigned> == ::std::is_unsigned_v<long unsigned>); - static_assert(::zp::isusgn<long long unsigned> == ::std::is_unsigned_v<long long unsigned>); - static_assert(::zp::isusgn<short unsigned> == ::std::is_unsigned_v<short unsigned>); - static_assert(::zp::isusgn<wchar_t> == ::std::is_unsigned_v<wchar_t>); + static_assert(::zp::isusgn<char>::val == ::std::is_unsigned_v<char>); + static_assert(::zp::isusgn<char16_t>::val == ::std::is_unsigned_v<char16_t>); + static_assert(::zp::isusgn<char32_t>::val == ::std::is_unsigned_v<char32_t>); + static_assert(::zp::isusgn<char8_t>::val == ::std::is_unsigned_v<char8_t>); + static_assert(::zp::isusgn<double>::val == ::std::is_unsigned_v<double>); + static_assert(::zp::isusgn<float>::val == ::std::is_unsigned_v<float>); + static_assert(::zp::isusgn<int>::val == ::std::is_unsigned_v<int>); + static_assert(::zp::isusgn<long>::val == ::std::is_unsigned_v<long>); + static_assert(::zp::isusgn<long double>::val == ::std::is_unsigned_v<long double>); + static_assert(::zp::isusgn<long long>::val == ::std::is_unsigned_v<long long>); + static_assert(::zp::isusgn<short>::val == ::std::is_unsigned_v<short>); + static_assert(::zp::isusgn<char signed>::val == ::std::is_unsigned_v<char signed>); + static_assert(::zp::isusgn<char unsigned>::val == ::std::is_unsigned_v<char unsigned>); + static_assert(::zp::isusgn<int unsigned>::val == ::std::is_unsigned_v<int unsigned>); + static_assert(::zp::isusgn<long unsigned>::val == ::std::is_unsigned_v<long unsigned>); + static_assert(::zp::isusgn<long long unsigned>::val == ::std::is_unsigned_v<long long unsigned>); + static_assert(::zp::isusgn<short unsigned>::val == ::std::is_unsigned_v<short unsigned>); + static_assert(::zp::isusgn<wchar_t>::val == ::std::is_unsigned_v<wchar_t>); - static_assert(::zp::issgn<char> == ::std::is_signed_v<char>); - static_assert(::zp::issgn<double> == ::std::is_signed_v<double>); - static_assert(::zp::issgn<float> == ::std::is_signed_v<float>); - static_assert(::zp::issgn<int> == ::std::is_signed_v<int>); - static_assert(::zp::issgn<long> == ::std::is_signed_v<long>); - static_assert(::zp::issgn<long double> == ::std::is_signed_v<long double>); - static_assert(::zp::issgn<long long> == ::std::is_signed_v<long long>); - static_assert(::zp::issgn<short> == ::std::is_signed_v<short>); - static_assert(::zp::issgn<char signed> == ::std::is_signed_v<char signed>); - static_assert(::zp::issgn<char unsigned> == ::std::is_signed_v<char unsigned>); - static_assert(::zp::issgn<int unsigned> == ::std::is_signed_v<int unsigned>); - static_assert(::zp::issgn<long unsigned> == ::std::is_signed_v<long unsigned>); - static_assert(::zp::issgn<long long unsigned> == ::std::is_signed_v<long long unsigned>); - static_assert(::zp::issgn<short unsigned> == ::std::is_signed_v<short unsigned>); - static_assert(::zp::issgn<wchar_t> == ::std::is_signed_v<wchar_t>); + static_assert(::zp::issgn<char>::val == ::std::is_signed_v<char>); + static_assert(::zp::issgn<double>::val == ::std::is_signed_v<double>); + static_assert(::zp::issgn<float>::val == ::std::is_signed_v<float>); + static_assert(::zp::issgn<int>::val == ::std::is_signed_v<int>); + static_assert(::zp::issgn<long>::val == ::std::is_signed_v<long>); + static_assert(::zp::issgn<long double>::val == ::std::is_signed_v<long double>); + static_assert(::zp::issgn<long long>::val == ::std::is_signed_v<long long>); + static_assert(::zp::issgn<short>::val == ::std::is_signed_v<short>); + static_assert(::zp::issgn<char signed>::val == ::std::is_signed_v<char signed>); + static_assert(::zp::issgn<char unsigned>::val == ::std::is_signed_v<char unsigned>); + static_assert(::zp::issgn<int unsigned>::val == ::std::is_signed_v<int unsigned>); + static_assert(::zp::issgn<long unsigned>::val == ::std::is_signed_v<long unsigned>); + static_assert(::zp::issgn<long long unsigned>::val == ::std::is_signed_v<long long unsigned>); + static_assert(::zp::issgn<short unsigned>::val == ::std::is_signed_v<short unsigned>); + static_assert(::zp::issgn<wchar_t>::val == ::std::is_signed_v<wchar_t>); static_assert(::zp::bytelen == CHAR_BIT); - static_assert(::zp::minval<bool> == ::std::numeric_limits<bool>::lowest()); - static_assert(::zp::minval<char> == ::std::numeric_limits<char>::lowest()); - static_assert(::zp::minval<char16_t> == ::std::numeric_limits<char16_t>::lowest()); - static_assert(::zp::minval<char32_t> == ::std::numeric_limits<char32_t>::lowest()); - static_assert(::zp::minval<char8_t> == ::std::numeric_limits<char8_t>::lowest()); - static_assert(::zp::minval<double> == ::std::numeric_limits<double>::lowest()); - static_assert(::zp::minval<float> == ::std::numeric_limits<float>::lowest()); - static_assert(::zp::minval<int> == ::std::numeric_limits<int>::lowest()); - static_assert(::zp::minval<long> == ::std::numeric_limits<long>::lowest()); - static_assert(::zp::minval<long double> == ::std::numeric_limits<long double>::lowest()); - static_assert(::zp::minval<long long> == ::std::numeric_limits<long long>::lowest()); - static_assert(::zp::minval<short> == ::std::numeric_limits<short>::lowest()); - static_assert(::zp::minval<char signed> == ::std::numeric_limits<char signed>::lowest()); - static_assert(::zp::minval<char unsigned> == ::std::numeric_limits<char unsigned>::lowest()); - static_assert(::zp::minval<short unsigned> == ::std::numeric_limits<short unsigned>::lowest()); - static_assert(::zp::minval<int unsigned> == ::std::numeric_limits<int unsigned>::lowest()); - static_assert(::zp::minval<long unsigned> == ::std::numeric_limits<long unsigned>::lowest()); - static_assert(::zp::minval<long long unsigned> == ::std::numeric_limits<long long unsigned>::lowest()); - static_assert(::zp::minval<wchar_t> == ::std::numeric_limits<wchar_t>::lowest()); + static_assert(::zp::minval<bool>::val == ::std::numeric_limits<bool>::lowest()); + static_assert(::zp::minval<char>::val == ::std::numeric_limits<char>::lowest()); + static_assert(::zp::minval<char16_t>::val == ::std::numeric_limits<char16_t>::lowest()); + static_assert(::zp::minval<char32_t>::val == ::std::numeric_limits<char32_t>::lowest()); + static_assert(::zp::minval<char8_t>::val == ::std::numeric_limits<char8_t>::lowest()); + static_assert(::zp::minval<double>::val == ::std::numeric_limits<double>::lowest()); + static_assert(::zp::minval<float>::val == ::std::numeric_limits<float>::lowest()); + static_assert(::zp::minval<int>::val == ::std::numeric_limits<int>::lowest()); + static_assert(::zp::minval<long>::val == ::std::numeric_limits<long>::lowest()); + static_assert(::zp::minval<long double>::val == ::std::numeric_limits<long double>::lowest()); + static_assert(::zp::minval<long long>::val == ::std::numeric_limits<long long>::lowest()); + static_assert(::zp::minval<short>::val == ::std::numeric_limits<short>::lowest()); + static_assert(::zp::minval<char signed>::val == ::std::numeric_limits<char signed>::lowest()); + static_assert(::zp::minval<char unsigned>::val == ::std::numeric_limits<char unsigned>::lowest()); + static_assert(::zp::minval<short unsigned>::val == ::std::numeric_limits<short unsigned>::lowest()); + static_assert(::zp::minval<int unsigned>::val == ::std::numeric_limits<int unsigned>::lowest()); + static_assert(::zp::minval<long unsigned>::val == ::std::numeric_limits<long unsigned>::lowest()); + static_assert(::zp::minval<long long unsigned>::val == ::std::numeric_limits<long long unsigned>::lowest()); + static_assert(::zp::minval<wchar_t>::val == ::std::numeric_limits<wchar_t>::lowest()); - static_assert(::zp::maxval<bool> == ::std::numeric_limits<bool>::max()); - static_assert(::zp::maxval<char> == ::std::numeric_limits<char>::max()); - static_assert(::zp::maxval<char16_t> == ::std::numeric_limits<char16_t>::max()); - static_assert(::zp::maxval<char32_t> == ::std::numeric_limits<char32_t>::max()); - static_assert(::zp::maxval<char8_t> == ::std::numeric_limits<char8_t>::max()); - static_assert(::zp::maxval<double> == ::std::numeric_limits<double>::max()); - static_assert(::zp::maxval<float> == ::std::numeric_limits<float>::max()); - static_assert(::zp::maxval<int> == ::std::numeric_limits<int>::max()); - static_assert(::zp::maxval<long> == ::std::numeric_limits<long>::max()); - static_assert(::zp::maxval<long double> == ::std::numeric_limits<long double>::max()); - static_assert(::zp::maxval<long long> == ::std::numeric_limits<long long>::max()); - static_assert(::zp::maxval<short> == ::std::numeric_limits<short>::max()); - static_assert(::zp::maxval<char signed> == ::std::numeric_limits<char signed>::max()); - static_assert(::zp::maxval<char unsigned> == ::std::numeric_limits<char unsigned>::max()); - static_assert(::zp::maxval<short unsigned> == ::std::numeric_limits<short unsigned>::max()); - static_assert(::zp::maxval<int unsigned> == ::std::numeric_limits<int unsigned>::max()); - static_assert(::zp::maxval<long unsigned> == ::std::numeric_limits<long unsigned>::max()); - static_assert(::zp::maxval<long long unsigned> == ::std::numeric_limits<long long unsigned>::max()); - static_assert(::zp::maxval<wchar_t> == ::std::numeric_limits<wchar_t>::max()); + static_assert(::zp::maxval<bool>::val == ::std::numeric_limits<bool>::max()); + static_assert(::zp::maxval<char>::val == ::std::numeric_limits<char>::max()); + static_assert(::zp::maxval<char16_t>::val == ::std::numeric_limits<char16_t>::max()); + static_assert(::zp::maxval<char32_t>::val == ::std::numeric_limits<char32_t>::max()); + static_assert(::zp::maxval<char8_t>::val == ::std::numeric_limits<char8_t>::max()); + static_assert(::zp::maxval<double>::val == ::std::numeric_limits<double>::max()); + static_assert(::zp::maxval<float>::val == ::std::numeric_limits<float>::max()); + static_assert(::zp::maxval<int>::val == ::std::numeric_limits<int>::max()); + static_assert(::zp::maxval<long>::val == ::std::numeric_limits<long>::max()); + static_assert(::zp::maxval<long double>::val == ::std::numeric_limits<long double>::max()); + static_assert(::zp::maxval<long long>::val == ::std::numeric_limits<long long>::max()); + static_assert(::zp::maxval<short>::val == ::std::numeric_limits<short>::max()); + static_assert(::zp::maxval<char signed>::val == ::std::numeric_limits<char signed>::max()); + static_assert(::zp::maxval<char unsigned>::val == ::std::numeric_limits<char unsigned>::max()); + static_assert(::zp::maxval<short unsigned>::val == ::std::numeric_limits<short unsigned>::max()); + static_assert(::zp::maxval<int unsigned>::val == ::std::numeric_limits<int unsigned>::max()); + static_assert(::zp::maxval<long unsigned>::val == ::std::numeric_limits<long unsigned>::max()); + 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()); return true; }()); diff --git a/zp/GNUmakefile b/zp/GNUmakefile index 41916fb..f37ccea 100644 --- a/zp/GNUmakefile +++ b/zp/GNUmakefile @@ -21,7 +21,7 @@ stdc := c99 endif ifeq "$(stdcxx)" "" -stdcxx := c++14 +stdcxx := c++11 endif OBJ_BS_TRP := source/any/bs/trp.o @@ -172,13 +172,13 @@ HDRS := \ include/zp/mth.d/vec2/cvec.ii \ include/zp/mth.d/vec3/cvec.ii \ include/zp/mth.d/vec4/cvec.ii \ - include/zp/priv/arc.h \ - include/zp/priv/chr.h \ - include/zp/priv/flt.h \ - include/zp/priv/imp.h \ - include/zp/priv/int.h \ - include/zp/priv/std.h \ - include/zp/priv/sys.h \ + include/zp/prv/arc.h \ + include/zp/prv/chr.h \ + include/zp/prv/flt.h \ + include/zp/prv/imp.h \ + include/zp/prv/int.h \ + include/zp/prv/std.h \ + include/zp/prv/sys.h \ include/zp/str.d/fmt.ii \ include/zp/str.d/fmtlen.ii \ include/zp/str.d/numdig.ii \ @@ -209,7 +209,7 @@ CFLAGS := \ -std=$(stdc) CXXFLAGS := \ - -Dzp_priv_nconsteval \ + -Dzp_prv_nconsteval \ -Iinclude \ -Oz \ -Wall \ @@ -253,7 +253,7 @@ install: $(LIB) mkdir -pvm755 "$(HDRDIR)/zp/mth.d/"{"pair","vec2","vec3","vec4"} mkdir -pvm755 "$(LIBDIR)" install -vm644 "include/zp/"{"bs","mem","mth","str"}{"",".h"} "$(HDRDIR)/zp" - install -vm644 "include/zp/priv/"{"arc","chr","flt","imp","int","std","sys"}".h" "$(HDRDIR)/zp/priv" + install -vm644 "include/zp/prv/"{"arc","chr","flt","imp","int","std","sys"}".h" "$(HDRDIR)/zp/priv" install -vm644 "include/zp/bs.d/"{"isconsteval","syscl","trp","urch"}".ii" "$(HDRDIR)/zp/bs.d" install -vm644 "include/zp/mem.d/"{"cpy","equ","fil","memcpy","memequ","memfil","memsrh","srh"}".ii" "$(HDRDIR)/zp/mem.d" install -vm644 "include/zp/mth.d/"{"abs","dist","divmod","dot","exp","isnan","vadd","vsub"}".ii" "$(HDRDIR)/zp/mth.d" diff --git a/zp/include/zp/bs b/zp/include/zp/bs index 473d6e3..7c28c21 100644 --- a/zp/include/zp/bs +++ b/zp/include/zp/bs @@ -4,11 +4,8 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -#ifndef zp_priv_cxxhdr_bs -#define zp_priv_cxxhdr_bs - -// C++11: constexpr, parameter pack -// C++14: template variables +#ifndef zp_prv_cxxhdr_bs +#define zp_prv_cxxhdr_bs #ifndef __cplusplus #error C++ header included from C! @@ -16,6 +13,18 @@ #include <zp/bs.h> +#if zp_std_cxx14 // C++11 doesn't support void as a return type for translation-time functions. +#define zp_prv_constexpr constexpr +#elif zp_std_cxx +#define zp_prv_constexpr inline +#endif + +#if zp_std_cxx11 +#define zp_prv_nthrw noexcept +#elif zp_std_cxx +#define zp_prv_nthrw +#endif + namespace zp { using i8m = ::zp_i8m; using i8ms = ::zp_i8ms; @@ -80,229 +89,196 @@ namespace zp { using nulptrtyp = ::zp_nulptrtyp; - namespace det { - template<typename typ> struct minval {constexpr static typ val = {};}; - - template<> struct minval<bool> {constexpr static auto val = false;}; - template<> struct minval<char> {constexpr static auto val = zp_minvalc;}; - template<> struct minval<char16_t> {constexpr static auto val = zp_minvalc01;}; - template<> struct minval<char32_t> {constexpr static auto val = zp_minvalc02;}; - template<> struct minval<double> {constexpr static auto val = zp_minvald;}; - template<> struct minval<float> {constexpr static auto val = zp_minvalf;}; - template<> struct minval<int> {constexpr static auto val = zp_minvali;}; - template<> struct minval<long> {constexpr static auto val = zp_minvall;}; - template<> struct minval<long double> {constexpr static auto val = zp_minvalld;}; - template<> struct minval<long long> {constexpr static auto val = zp_minvalll;}; - template<> struct minval<short> {constexpr static auto val = zp_minvals;}; - template<> struct minval<char signed> {constexpr static auto val = zp_minvalcs;}; - template<> struct minval<char unsigned> {constexpr static auto val = zp_minvalcu;}; - template<> struct minval<int unsigned> {constexpr static auto val = zp_minvaliu;}; - template<> struct minval<long unsigned> {constexpr static auto val = zp_minvallu;}; - template<> struct minval<long long unsigned> {constexpr static auto val = zp_minvalllu;}; - template<> struct minval<short unsigned> {constexpr static auto val = zp_minvalsu;}; - template<> struct minval<wchar_t> {constexpr static auto val = zp_minvalw;}; - template<> struct minval<::zp::nulptrtyp> {constexpr static auto val = nullptr;}; + template<typename typ> struct minval {constexpr static typ val = {};}; + + template<> struct minval<bool> {constexpr static auto val = false;}; + template<> struct minval<char> {constexpr static auto val = zp_minvalc;}; + template<> struct minval<char16_t> {constexpr static auto val = zp_minvalc01;}; + template<> struct minval<char32_t> {constexpr static auto val = zp_minvalc02;}; + template<> struct minval<double> {constexpr static auto val = zp_minvald;}; + template<> struct minval<float> {constexpr static auto val = zp_minvalf;}; + template<> struct minval<int> {constexpr static auto val = zp_minvali;}; + template<> struct minval<long> {constexpr static auto val = zp_minvall;}; + template<> struct minval<long double> {constexpr static auto val = zp_minvalld;}; + template<> struct minval<long long> {constexpr static auto val = zp_minvalll;}; + template<> struct minval<short> {constexpr static auto val = zp_minvals;}; + template<> struct minval<char signed> {constexpr static auto val = zp_minvalcs;}; + template<> struct minval<char unsigned> {constexpr static auto val = zp_minvalcu;}; + template<> struct minval<int unsigned> {constexpr static auto val = zp_minvaliu;}; + template<> struct minval<long unsigned> {constexpr static auto val = zp_minvallu;}; + template<> struct minval<long long unsigned> {constexpr static auto val = zp_minvalllu;}; + template<> struct minval<short unsigned> {constexpr static auto val = zp_minvalsu;}; + template<> struct minval<wchar_t> {constexpr static auto val = zp_minvalw;}; #if __cpp_char8_t >= 201811 - template<> struct minval<char8_t> {constexpr static auto val = zp_minvalc8;}; -#endif - - template<typename typ> struct maxval {constexpr static typ val = {};}; - - template<> struct maxval<bool> {constexpr static auto val = true;}; - template<> struct maxval<char> {constexpr static auto val = zp_maxvalc;}; - template<> struct maxval<char16_t> {constexpr static auto val = zp_maxvalc01;}; - template<> struct maxval<char32_t> {constexpr static auto val = zp_maxvalc02;}; - template<> struct maxval<double> {constexpr static auto val = zp_maxvald;}; - template<> struct maxval<float> {constexpr static auto val = zp_maxvalf;}; - template<> struct maxval<int> {constexpr static auto val = zp_maxvali;}; - template<> struct maxval<long> {constexpr static auto val = zp_maxvall;}; - template<> struct maxval<long double> {constexpr static auto val = zp_maxvalld;}; - template<> struct maxval<long long> {constexpr static auto val = zp_maxvalll;}; - template<> struct maxval<short> {constexpr static auto val = zp_maxvals;}; - template<> struct maxval<char signed> {constexpr static auto val = zp_maxvalcs;}; - template<> struct maxval<char unsigned> {constexpr static auto val = zp_maxvalcu;}; - template<> struct maxval<int unsigned> {constexpr static auto val = zp_maxvaliu;}; - template<> struct maxval<long unsigned> {constexpr static auto val = zp_maxvallu;}; - template<> struct maxval<long long unsigned> {constexpr static auto val = zp_maxvalllu;}; - template<> struct maxval<short unsigned> {constexpr static auto val = zp_maxvalsu;}; - template<> struct maxval<wchar_t> {constexpr static auto val = zp_maxvalw;}; - template<> struct maxval<::zp::nulptrtyp> {constexpr static auto val = nullptr;}; + template<> struct minval<char8_t> {constexpr static auto val = zp_minvalc8;}; +#endif + + template<typename typ> struct maxval {constexpr static typ val = {};}; + + template<> struct maxval<bool> {constexpr static auto val = true;}; + template<> struct maxval<char> {constexpr static auto val = zp_maxvalc;}; + template<> struct maxval<char16_t> {constexpr static auto val = zp_maxvalc01;}; + template<> struct maxval<char32_t> {constexpr static auto val = zp_maxvalc02;}; + template<> struct maxval<double> {constexpr static auto val = zp_maxvald;}; + template<> struct maxval<float> {constexpr static auto val = zp_maxvalf;}; + template<> struct maxval<int> {constexpr static auto val = zp_maxvali;}; + template<> struct maxval<long> {constexpr static auto val = zp_maxvall;}; + template<> struct maxval<long double> {constexpr static auto val = zp_maxvalld;}; + template<> struct maxval<long long> {constexpr static auto val = zp_maxvalll;}; + template<> struct maxval<short> {constexpr static auto val = zp_maxvals;}; + template<> struct maxval<char signed> {constexpr static auto val = zp_maxvalcs;}; + template<> struct maxval<char unsigned> {constexpr static auto val = zp_maxvalcu;}; + template<> struct maxval<int unsigned> {constexpr static auto val = zp_maxvaliu;}; + template<> struct maxval<long unsigned> {constexpr static auto val = zp_maxvallu;}; + template<> struct maxval<long long unsigned> {constexpr static auto val = zp_maxvalllu;}; + template<> struct maxval<short unsigned> {constexpr static auto val = zp_maxvalsu;}; + template<> struct maxval<wchar_t> {constexpr static auto val = zp_maxvalw;}; #if __cpp_char8_t >= 201811 - template<> struct maxval<char8_t> {constexpr static auto val = zp_maxvalc8;}; -#endif - } - - template<typename typ> constexpr auto minval = ::zp::det::minval<typ>::val; - template<typename typ> constexpr auto maxval = ::zp::det::maxval<typ>::val; - - namespace det { - template<typename ityp> struct sgn {using typ = ityp;}; - - template<> struct sgn<char unsigned> {using typ = char signed;}; - template<> struct sgn<int unsigned> {using typ = int;}; - template<> struct sgn<long unsigned> {using typ = long;}; - template<> struct sgn<long long unsigned> {using typ = long long;}; - template<> struct sgn<short unsigned> {using typ = short;}; - - template<typename ityp> struct usgn {using typ = ityp;}; - - template<> struct usgn<char signed> {using typ = char unsigned;}; - template<> struct usgn<int> {using typ = int unsigned;}; - template<> struct usgn<long> {using typ = long unsigned;}; - template<> struct usgn<long long> {using typ = long long unsigned;}; - template<> struct usgn<short> {using typ = short unsigned;}; - } - - template<typename typ> using sgn = typename ::zp::det::sgn<typ>::typ; - template<typename typ> using usgn = typename ::zp::det::usgn<typ>::typ; - - namespace det { - template<typename ityp> struct remqual {using typ = ityp;}; - - template<typename ityp> struct remqual<ityp const> {using typ = ityp;}; - template<typename ityp> struct remqual<ityp volatile> {using typ = ityp;}; - template<typename ityp> struct remqual<ityp const volatile> {using typ = ityp;}; - } - - template<typename typ> using remqual = typename ::zp::det::remqual<typ>::typ; - - namespace det { - template<typename ltyp,typename rtyp> struct typequ {constexpr static bool equ = false;}; - - template<typename typ> struct typequ<typ,typ> {constexpr static auto equ = true;}; - } - - template<typename ltyp,typename rtyp> constexpr auto typequ = ::zp::det::typequ<ltyp,rtyp>::equ; - - namespace det { - template<typename typ> struct isptr {constexpr static bool val = false;}; - - template<typename typ> struct isptr<typ *> {constexpr static auto val = true;}; - template<typename typ> struct isptr<typ const *> {constexpr static auto val = true;}; - template<typename typ> struct isptr<typ volatile *> {constexpr static auto val = true;}; - template<typename typ> struct isptr<typ const volatile *> {constexpr static auto val = true;}; - template<typename typ> struct isptr<typ * const> {constexpr static auto val = true;}; - template<typename typ> struct isptr<typ const * const> {constexpr static auto val = true;}; - template<typename typ> struct isptr<typ volatile * const> {constexpr static auto val = true;}; - template<typename typ> struct isptr<typ const volatile * const> {constexpr static auto val = true;}; - template<typename typ> struct isptr<typ * volatile> {constexpr static auto val = true;}; - template<typename typ> struct isptr<typ const * volatile> {constexpr static auto val = true;}; - template<typename typ> struct isptr<typ volatile * volatile> {constexpr static auto val = true;}; - template<typename typ> struct isptr<typ const volatile * volatile> {constexpr static auto val = true;}; - template<typename typ> struct isptr<typ * const volatile> {constexpr static auto val = true;}; - template<typename typ> struct isptr<typ const * const volatile> {constexpr static auto val = true;}; - template<typename typ> struct isptr<typ volatile * const volatile> {constexpr static auto val = true;}; - template<typename typ> struct isptr<typ const volatile * const volatile> {constexpr static auto val = true;}; - } - - template<typename typ> constexpr auto isptr = ::zp::det::isptr<typ>::val; - - template<typename typ> constexpr auto isusgn = - ::zp::typequ<typ,char16_t> - || ::zp::typequ<typ,char32_t> - || ::zp::typequ<typ,char unsigned> - || ::zp::typequ<typ,int unsigned> - || ::zp::typequ<typ,long unsigned> - || ::zp::typequ<typ,long long unsigned> - || ::zp::typequ<typ,short unsigned> - || ::zp::typequ<typ,::zp_i8m> - || ::zp::typequ<typ,::zp_i01m> - || ::zp::typequ<typ,::zp_i02m> - || ::zp::typequ<typ,::zp_i04m> -#if __cpp_char8_t - || ::zp::typequ<typ,char8_t> + template<> struct maxval<char8_t> {constexpr static auto val = zp_maxvalc8;}; #endif -#if zp_fixint08 - || ::zp::typequ<typ,::zp_i08> + + template<typename ityp> struct sgn {using typ = ityp;}; + + template<> struct sgn<char unsigned> {using typ = char signed;}; + template<> struct sgn<int unsigned> {using typ = int;}; + template<> struct sgn<long unsigned> {using typ = long;}; + template<> struct sgn<long long unsigned> {using typ = long long;}; + template<> struct sgn<short unsigned> {using typ = short;}; + + template<typename ityp> struct usgn {using typ = ityp;}; + + template<> struct usgn<char signed> {using typ = char unsigned;}; + template<> struct usgn<int> {using typ = int unsigned;}; + template<> struct usgn<long> {using typ = long unsigned;}; + template<> struct usgn<long long> {using typ = long long unsigned;}; + template<> struct usgn<short> {using typ = short unsigned;}; + + template<typename ityp> struct remqual {using typ = ityp;}; + + template<typename ityp> struct remqual<ityp const> {using typ = ityp;}; + template<typename ityp> struct remqual<ityp volatile> {using typ = ityp;}; + template<typename ityp> struct remqual<ityp const volatile> {using typ = ityp;}; + + template<typename ltyp,typename rtyp> struct typequ {constexpr static bool val = false;}; + + template<typename typ> struct typequ<typ,typ> {constexpr static auto val = true;}; + + template<typename typ> struct isptr {constexpr static bool val = false;}; + + template<typename typ> struct isptr<typ *> {constexpr static auto val = true;}; + template<typename typ> struct isptr<typ const *> {constexpr static auto val = true;}; + template<typename typ> struct isptr<typ volatile *> {constexpr static auto val = true;}; + template<typename typ> struct isptr<typ const volatile *> {constexpr static auto val = true;}; + template<typename typ> struct isptr<typ * const> {constexpr static auto val = true;}; + template<typename typ> struct isptr<typ const * const> {constexpr static auto val = true;}; + template<typename typ> struct isptr<typ volatile * const> {constexpr static auto val = true;}; + template<typename typ> struct isptr<typ const volatile * const> {constexpr static auto val = true;}; + template<typename typ> struct isptr<typ * volatile> {constexpr static auto val = true;}; + template<typename typ> struct isptr<typ const * volatile> {constexpr static auto val = true;}; + template<typename typ> struct isptr<typ volatile * volatile> {constexpr static auto val = true;}; + template<typename typ> struct isptr<typ const volatile * volatile> {constexpr static auto val = true;}; + template<typename typ> struct isptr<typ * const volatile> {constexpr static auto val = true;}; + template<typename typ> struct isptr<typ const * const volatile> {constexpr static auto val = true;}; + template<typename typ> struct isptr<typ volatile * const volatile> {constexpr static auto val = true;}; + template<typename typ> struct isptr<typ const volatile * const volatile> {constexpr static auto val = true;}; + + template<typename typ> struct isusgn {constexpr static bool val = false;}; + + template<> struct isusgn<char16_t> {constexpr static auto val = true;}; + template<> struct isusgn<char32_t> {constexpr static auto val = true;}; + template<> struct isusgn<char unsigned> {constexpr static auto val = true;}; + template<> struct isusgn<int unsigned> {constexpr static auto val = true;}; + template<> struct isusgn<long unsigned> {constexpr static auto val = true;}; + template<> struct isusgn<long long unsigned> {constexpr static auto val = true;}; + template<> struct isusgn<short unsigned> {constexpr static auto val = true;}; +#if __cpp_char8_t >= 201811 + template<> struct isusgn<char8_t> {constexpr static auto val = true;}; #endif #if zp_uchr - || ::zp::typequ<typ,char> + template<> struct isusgn<char> {constexpr static auto val = true;}; #endif #if zp_uwchr - || ::zp::typequ<typ,wchar_t> -#endif - || false; - - template<typename typ> constexpr auto issgn = - ::zp::typequ<typ,double> - || ::zp::typequ<typ,float> - || ::zp::typequ<typ,int> - || ::zp::typequ<typ,long> - || ::zp::typequ<typ,long double> - || ::zp::typequ<typ,long long> - || ::zp::typequ<typ,short> - || ::zp::typequ<typ,char signed> - || ::zp::typequ<typ,::zp_i8ms> - || ::zp::typequ<typ,::zp_i01ms> - || ::zp::typequ<typ,::zp_i02ms> - || ::zp::typequ<typ,::zp_i04ms> + template<> struct isusgn<wchar_t> {constexpr static auto val = true;}; +#endif + + template<typename typ> struct issgn {constexpr static bool val = false;}; + + template<> struct issgn<double> {constexpr static auto val = true;}; + template<> struct issgn<float> {constexpr static auto val = true;}; + template<> struct issgn<int> {constexpr static auto val = true;}; + template<> struct issgn<long> {constexpr static auto val = true;}; + template<> struct issgn<long double> {constexpr static auto val = true;}; + template<> struct issgn<long long> {constexpr static auto val = true;}; + template<> struct issgn<short> {constexpr static auto val = true;}; + template<> struct issgn<char signed> {constexpr static auto val = true;}; #if __STDCPP_BFLOAT16_T__ - || ::zp::typequ<typ,decltype (0.0bf16)> + template<> struct issgn<decltype (0.0bf16)> {constexpr static auto val = true;}; #endif -#if zp_fixflt01 - || ::zp::typequ<typ,::zp_f01> +#if __STDCPP_FLOAT128_T__ + template<> struct issgn<decltype (0.0f128)> {constexpr static auto val = true;}; #endif -#if zp_fixflt02 - || ::zp::typequ<typ,::zp_f02> +#if __STDCPP_FLOAT16_T__ + template<> struct issgn<decltype (0.0f16)> {constexpr static auto val = true;}; #endif -#if zp_fixflt04 - || ::zp::typequ<typ,::zp_f04> +#if __STDCPP_FLOAT32_T__ + template<> struct issgn<decltype (0.0f32)> {constexpr static auto val = true;}; #endif -#if zp_fixint08 - || ::zp::typequ<typ,::zp_i08s> +#if __STDCPP_FLOAT64_T__ + template<> struct issgn<decltype (0.0f64)> {constexpr static auto val = true;}; #endif #if !zp_uchr - || ::zp::typequ<typ,char> + template<> struct issgn<char> {constexpr static auto val = true;}; #endif #if !zp_uwchr - || ::zp::typequ<typ,wchar_t> -#endif - || false; - - template<typename typ> constexpr auto ischr = - ::zp::typequ<typ,char> - || ::zp::typequ<typ,char unsigned> - || ::zp::typequ<typ,wchar_t> - || ::zp::typequ<typ,::zp_c01> - || ::zp::typequ<typ,::zp_c02> - || ::zp::typequ<typ,::zp_c8>; - - template<typename typ> constexpr auto isflt = - ::zp::typequ<typ,double> - || ::zp::typequ<typ,float> - || ::zp::typequ<typ,long double> + template<> struct issgn<wchar_t> {constexpr static auto val = true;}; +#endif + + template<typename typ> struct isflt {constexpr static bool val = false;}; + + template<> struct isflt<double> {constexpr static auto val = true;}; + template<> struct isflt<float> {constexpr static auto val = true;}; + template<> struct isflt<long double> {constexpr static auto val = true;}; #if __STDCPP_BFLOAT16_T__ - || ::zp::typequ<typ,decltype (0.0bf16)> + template<> struct isflt<decltype (0.0bf16)> {constexpr static auto val = true;}; #endif #if __STDCPP_FLOAT128_T__ - || ::zp::typequ<typ,decltype (0.0f128)> + template<> struct isflt<decltype (0.0f128)> {constexpr static auto val = true;}; #endif #if __STDCPP_FLOAT16_T__ - || ::zp::typequ<typ,decltype (0.0f16)> + template<> struct isflt<decltype (0.0f16)> {constexpr static auto val = true;}; #endif #if __STDCPP_FLOAT32_T__ - || ::zp::typequ<typ,decltype (0.0f32)> + template<> struct isflt<decltype (0.0f32)> {constexpr static auto val = true;}; #endif #if __STDCPP_FLOAT64_T__ - || ::zp::typequ<typ,decltype (0.0f64)> -#endif - || false; - - template<typename typ> constexpr auto isint = - ::zp::typequ<typ,int> - || ::zp::typequ<typ,long> - || ::zp::typequ<typ,long long> - || ::zp::typequ<typ,short> - || ::zp::typequ<typ,char signed> - || ::zp::typequ<typ,char unsigned> - || ::zp::typequ<typ,int unsigned> - || ::zp::typequ<typ,long unsigned> - || ::zp::typequ<typ,long long unsigned> - || ::zp::typequ<typ,short unsigned>; - - template<typename typ> constexpr auto isarith = - ::zp::isflt<typ> - || ::zp::isint<typ>; + template<> struct isflt<decltype (0.0f64)> {constexpr static auto val = true;}; +#endif + + template<typename typ> struct isint {constexpr static bool val = false;}; + + template<> struct isint<int> {constexpr static auto val = true;}; + template<> struct isint<long> {constexpr static auto val = true;}; + template<> struct isint<long long> {constexpr static auto val = true;}; + template<> struct isint<short> {constexpr static auto val = true;}; + template<> struct isint<char signed> {constexpr static auto val = true;}; + template<> struct isint<char unsigned> {constexpr static auto val = true;}; + template<> struct isint<int unsigned> {constexpr static auto val = true;}; + template<> struct isint<long unsigned> {constexpr static auto val = true;}; + template<> struct isint<long long unsigned> {constexpr static auto val = true;}; + template<> struct isint<short unsigned> {constexpr static auto val = true;}; + + template<typename typ> struct isari {constexpr static bool val = ::zp::isflt<typ>::val || ::zp::isint<typ>::val;}; + + template<typename typ> struct ischr {constexpr static bool val = false;}; + + template<> struct ischr<char> {constexpr static auto val = true;}; + template<> struct ischr<char unsigned> {constexpr static auto val = true;}; + template<> struct ischr<char16_t> {constexpr static auto val = true;}; + template<> struct ischr<char32_t> {constexpr static auto val = true;}; + template<> struct ischr<wchar_t> {constexpr static auto val = true;}; +#if __cpp_char8_t >= 201811 + template<> struct ischr<char8_t> {constexpr static auto val = true;}; +#endif constexpr auto ver = zp_ver; constexpr auto extver = zp_extver; @@ -313,12 +289,12 @@ namespace zp { constexpr auto unimax = zp_unimax; - zp_iln constexpr auto isconsteval() noexcept -> bool; + zp_iln constexpr auto isconsteval() zp_prv_nthrw -> bool; - [[noreturn]] zp_iln inline auto trp() noexcept -> void; - [[noreturn]] zp_iln inline auto urch() noexcept -> void; + [[noreturn]] zp_iln inline auto trp() zp_prv_nthrw -> void; + [[noreturn]] zp_iln inline auto urch() zp_prv_nthrw -> void; - template<typename... typs> zp_iln inline auto syscl(::zp::sysclid id,typs const &... args) noexcept -> ::zp::sysclres; + template<typename... typs> zp_iln inline auto syscl(::zp::sysclid id,typs const &... args) zp_prv_nthrw -> ::zp::sysclres; } #include <zp/bs.d/isconsteval.ii> diff --git a/zp/include/zp/bs.d/isconsteval.ii b/zp/include/zp/bs.d/isconsteval.ii index c3e3d85..96af2ff 100644 --- a/zp/include/zp/bs.d/isconsteval.ii +++ b/zp/include/zp/bs.d/isconsteval.ii @@ -4,8 +4,8 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -constexpr auto ::zp::isconsteval() noexcept -> bool { -#if zp_priv_hasbuiltin(__builtin_is_constant_evaluated) +constexpr auto ::zp::isconsteval() zp_prv_nthrw -> bool { +#if zp_prv_hasbuiltin(__builtin_is_constant_evaluated) return __builtin_is_constant_evaluated(); #elif __cpp_if_consteval >= 202106 if consteval {return true;} diff --git a/zp/include/zp/bs.d/syscl.ii b/zp/include/zp/bs.d/syscl.ii index 273324e..3723d9b 100644 --- a/zp/include/zp/bs.d/syscl.ii +++ b/zp/include/zp/bs.d/syscl.ii @@ -4,6 +4,6 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -template<typename... typs> inline auto ::zp::syscl(::zp::sysclid const id,typs const &... args) noexcept -> ::zp::sysclres { +template<typename... typs> inline auto ::zp::syscl(::zp::sysclid const id,typs const &... args) zp_prv_nthrw -> ::zp::sysclres { return ::zp_syscl(id,args...); } diff --git a/zp/include/zp/bs.d/trp.ii b/zp/include/zp/bs.d/trp.ii index 06ee500..1743103 100644 --- a/zp/include/zp/bs.d/trp.ii +++ b/zp/include/zp/bs.d/trp.ii @@ -4,6 +4,6 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -inline auto ::zp::trp() noexcept -> void { +inline auto ::zp::trp() zp_prv_nthrw -> void { ::zp_trp(); }
\ No newline at end of file diff --git a/zp/include/zp/bs.d/urch.ii b/zp/include/zp/bs.d/urch.ii index 7c33a0a..49b9a42 100644 --- a/zp/include/zp/bs.d/urch.ii +++ b/zp/include/zp/bs.d/urch.ii @@ -4,6 +4,6 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -inline auto ::zp::urch() noexcept -> void { +inline auto ::zp::urch() zp_prv_nthrw -> void { zp_urch(); } diff --git a/zp/include/zp/bs.h b/zp/include/zp/bs.h index 582608b..2ecd5f4 100644 --- a/zp/include/zp/bs.h +++ b/zp/include/zp/bs.h @@ -16,8 +16,8 @@ └→ str */ -#ifndef zp_priv_hdr_bs -#define zp_priv_hdr_bs +#ifndef zp_prv_hdr_bs +#define zp_prv_hdr_bs // C99: long long @@ -68,7 +68,7 @@ that doesn't result in ANY "broken" code, such as just always returning true in isconsteval, which would break if we returned false, as - this could lead to reaching non-constexpr + this could lead to reaching non-zp_prv_constexpr friendly code. For types that have their own built-in type in @@ -88,38 +88,38 @@ being just the GNU ABI. */ -#include <zp/priv/imp.h> +#include <zp/prv/imp.h> -#include <zp/priv/arc.h> -#include <zp/priv/sys.h> +#include <zp/prv/arc.h> +#include <zp/prv/sys.h> -#include <zp/priv/std.h> +#include <zp/prv/std.h> #if zp_std_cxx -#define zp_priv_cdecl extern "C" { -#define zp_priv_cdeclend } +#define zp_prv_cdecl extern "C" { +#define zp_prv_cdeclend } #else -#define zp_priv_cdecl -#define zp_priv_cdeclend +#define zp_prv_cdecl +#define zp_prv_cdeclend #endif #ifdef __has_builtin -#define zp_priv_hasbuiltin(builtin) __has_builtin(builtin) +#define zp_prv_hasbuiltin(builtin) __has_builtin(builtin) #else -#define zp_priv_hasbuiltin(builtin) (0x0) +#define zp_prv_hasbuiltin(builtin) (0x0) #endif #ifdef __has_attribute -#define zp_priv_hasattr(attr) __has_attribute(attr) +#define zp_prv_hasattr(attr) __has_attribute(attr) #else -#define zp_priv_hasattr(attr) (0x0) +#define zp_prv_hasattr(attr) (0x0) #endif // ext: GCC complains when we use __int128 without using "__extension__". -#ifdef zp_imp_gcc -#define zp_priv_ext __extension__ +#if zp_imp_gcc +#define zp_prv_ext __extension__ #else -#define zp_priv_ext +#define zp_prv_ext #endif #ifndef __cplusplus @@ -159,7 +159,7 @@ #define zp_restr #endif -#if zp_priv_hasbuiltin(__builtin_expect) +#if zp_prv_hasbuiltin(__builtin_expect) #define zp_lik(expr) if (__builtin_expect((expr),0x1)) #define zp_ulik(expr) if (__builtin_expect((expr),0x0)) #elif zp_std_cxx20 @@ -170,7 +170,7 @@ #define zp_ulik(expr) if ((expr)) #endif -#if zp_priv_hasattr(__noreturn__) +#if zp_prv_hasattr(__noreturn__) #define zp_nret __attribute__ ((__noreturn__)) #elif zp_imp_msvc #define zp_nret __declspec (noreturn) @@ -182,13 +182,13 @@ #define zp_nret #endif -#if zp_priv_hasattr(__always_inline__) +#if zp_prv_hasattr(__always_inline__) #define zp_iln __attribute__ ((__always_inline__)) #else #define zp_iln #endif -#if zp_priv_hasattr(__nothrow__) +#if zp_prv_hasattr(__nothrow__) #define zp_nthrw __attribute__ ((__nothrow__)) #elif zp_imp_msvc #define zp_nthrw __declspec (nothrow) @@ -196,7 +196,7 @@ #define zp_nthrw #endif -#if zp_priv_hasattr(__const__) +#if zp_prv_hasattr(__const__) #define zp_useq __attribute__ ((__const__)) #elif zp_std_c23 #define zp_useq [[unsequenced]] @@ -204,7 +204,7 @@ #define zp_useq #endif -#if zp_priv_hasattr(__unused__) +#if zp_prv_hasattr(__unused__) #define zp_nuse __attribute__ ((__unused__)) #elif zp_std_c23 || zp_std_cxx #define zp_nuse [[maybe_unused]] @@ -212,7 +212,7 @@ #define zp_nuse #endif -#if zp_priv_hasbuiltin(__builtin_unreachable) +#if zp_prv_hasbuiltin(__builtin_unreachable) #define zp_urch() ((void)__builtin_unreachable()) #elif zp_imp_msvc #define zp_urch() ((void)__assume(0x0)) @@ -220,7 +220,7 @@ #define zp_urch() (zp_trp()) #endif -#if zp_priv_hasattr(__warn_unused_result__) +#if zp_prv_hasattr(__warn_unused_result__) #define zp_useres __attribute__ ((warn_unused_result)) #elif zp_std_c23 || zp_std_cxx17 #define zp_useres [[nodiscard]] @@ -228,12 +228,12 @@ #define zp_useres #endif -zp_priv_cdecl +zp_prv_cdecl -#include <zp/priv/int.h> -#include <zp/priv/flt.h> +#include <zp/prv/int.h> +#include <zp/prv/flt.h> -#include <zp/priv/chr.h> +#include <zp/prv/chr.h> /* We define the sysclid as the platform type @@ -314,6 +314,6 @@ zp_nret void zp_trp(void); zp_sysclres zp_syscl(zp_sysclid id,...); -zp_priv_cdeclend +zp_prv_cdeclend #endif diff --git a/zp/include/zp/mem b/zp/include/zp/mem index dbd02d9..9d644e1 100644 --- a/zp/include/zp/mem +++ b/zp/include/zp/mem @@ -4,8 +4,8 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -#ifndef zp_priv_cxxhdr_mem -#define zp_priv_cxxhdr_mem +#ifndef zp_prv_cxxhdr_mem +#define zp_prv_cxxhdr_mem #include <zp/bs> #include <zp/mem.h> @@ -16,23 +16,23 @@ namespace zp { srctyp * src; }; - template<typename dsttyp,typename srctyp> zp_iln inline auto memcpy(dsttyp * zp_restr dst,srctyp const * zp_restr src,::zp::sz const num) noexcept -> ::zp::cpyres<dsttyp,srctyp>; + template<typename dsttyp,typename srctyp> zp_iln inline auto memcpy(dsttyp * zp_restr dst,srctyp const * zp_restr src,::zp::sz const num) zp_prv_nthrw -> ::zp::cpyres<dsttyp,srctyp>; - template<typename ltyp,typename rtyp> zp_useres zp_iln inline auto memequ(ltyp const * lbuf,rtyp const * rbuf,::zp::sz const num) noexcept -> bool; + template<typename ltyp,typename rtyp> zp_useres zp_iln inline auto memequ(ltyp const * lbuf,rtyp const * rbuf,::zp::sz const num) zp_prv_nthrw -> bool; - template<typename typ> zp_iln inline auto memfil(typ * dst,char unsigned val,::zp::sz const num) noexcept -> typ *; + template<typename typ> zp_iln inline auto memfil(typ * dst,char unsigned val,::zp::sz const num) zp_prv_nthrw -> typ *; - template<typename typ> zp_useres zp_iln inline auto memsrh(typ * buf,char unsigned val,::zp::sz const num) noexcept -> typ *; - template<typename typ> zp_useres zp_iln inline auto memsrh(typ const * buf,char unsigned val,::zp::sz const num) noexcept -> typ const *; + template<typename typ> zp_useres zp_iln inline auto memsrh(typ * buf,char unsigned val,::zp::sz const num) zp_prv_nthrw -> typ *; + template<typename typ> zp_useres zp_iln inline auto memsrh(typ const * buf,char unsigned val,::zp::sz const num) zp_prv_nthrw -> typ const *; - template<typename typ> constexpr auto cpy(typ * zp_restr dst,typ const * zp_restr src,::zp::sz const num) noexcept -> ::zp::cpyres<typ,typ>; + template<typename typ> zp_prv_constexpr auto cpy(typ * zp_restr dst,typ const * zp_restr src,::zp::sz const num) zp_prv_nthrw -> ::zp::cpyres<typ,typ>; - template<typename typ> zp_useres constexpr auto equ(typ const * lbuf,typ const * rbuf,::zp::sz const num) noexcept -> bool; + template<typename typ> zp_useres zp_prv_constexpr auto equ(typ const * lbuf,typ const * rbuf,::zp::sz const num) zp_prv_nthrw -> bool; - template<typename typ> constexpr auto fil(typ * dst,typ const val,::zp::sz const num) noexcept -> typ *; + template<typename typ> zp_prv_constexpr auto fil(typ * dst,typ const val,::zp::sz const num) zp_prv_nthrw -> typ *; - template<typename typ> zp_useres constexpr auto srh(typ * buf,typ const val,::zp::sz const num) noexcept -> typ *; - template<typename typ> zp_useres constexpr auto srh(typ const * buf,typ const val,::zp::sz const num) noexcept -> typ const *; + template<typename typ> zp_useres zp_prv_constexpr auto srh(typ * buf,typ const val,::zp::sz const num) zp_prv_nthrw -> typ *; + template<typename typ> zp_useres zp_prv_constexpr auto srh(typ const * buf,typ const val,::zp::sz const num) zp_prv_nthrw -> typ const *; } #include <zp/mem.d/cpy.ii> diff --git a/zp/include/zp/mem.d/cpy.ii b/zp/include/zp/mem.d/cpy.ii index 3a09996..8ddaf9a 100644 --- a/zp/include/zp/mem.d/cpy.ii +++ b/zp/include/zp/mem.d/cpy.ii @@ -4,7 +4,7 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -template<typename typ> constexpr auto ::zp::cpy(typ * zp_restr dst,typ const * zp_restr src,::zp::sz const num) noexcept -> ::zp::cpyres<typ,typ> { +template<typename typ> zp_prv_constexpr auto ::zp::cpy(typ * zp_restr dst,typ const * zp_restr src,::zp::sz const num) zp_prv_nthrw -> ::zp::cpyres<typ,typ> { typ * const zp_restr stp = dst+num; while (dst != stp) {*dst++ = *src++;} diff --git a/zp/include/zp/mem.d/equ.ii b/zp/include/zp/mem.d/equ.ii index e80d555..abb58ee 100644 --- a/zp/include/zp/mem.d/equ.ii +++ b/zp/include/zp/mem.d/equ.ii @@ -4,7 +4,7 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -template<typename typ> constexpr auto ::zp::equ(typ const * lbuf,typ const * rbuf,::zp::sz const num) noexcept -> bool { +template<typename typ> zp_prv_constexpr auto ::zp::equ(typ const * lbuf,typ const * rbuf,::zp::sz const num) zp_prv_nthrw -> bool { typ const * const stp = lbuf+num; while (lbuf != stp) { diff --git a/zp/include/zp/mem.d/fil.ii b/zp/include/zp/mem.d/fil.ii index f13da76..7cdd57b 100644 --- a/zp/include/zp/mem.d/fil.ii +++ b/zp/include/zp/mem.d/fil.ii @@ -4,7 +4,7 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -template<typename typ> constexpr auto ::zp::fil(typ * dst,typ const val,::zp::sz const num) noexcept -> typ * { +template<typename typ> zp_prv_constexpr auto ::zp::fil(typ * dst,typ const val,::zp::sz const num) zp_prv_nthrw -> typ * { typ * const stp = dst+num; while (dst != stp) {*dst++ = val;} diff --git a/zp/include/zp/mem.d/memcpy.ii b/zp/include/zp/mem.d/memcpy.ii index add3f27..928ff11 100644 --- a/zp/include/zp/mem.d/memcpy.ii +++ b/zp/include/zp/mem.d/memcpy.ii @@ -4,7 +4,7 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -template<typename dsttyp,typename srctyp> inline auto ::zp::memcpy(dsttyp * zp_restr dst,srctyp const * zp_restr src,::zp::sz const num) noexcept -> ::zp::cpyres<dsttyp,srctyp> { +template<typename dsttyp,typename srctyp> inline auto ::zp::memcpy(dsttyp * zp_restr dst,srctyp const * zp_restr src,::zp::sz const num) zp_prv_nthrw -> ::zp::cpyres<dsttyp,srctyp> { ::zp_cpyres const cpyres = ::zp_memcpy(dst,src,num); return ::zp::cpyres<dsttyp,srctyp> {static_cast<dsttyp *>(cpyres.dst),static_cast<srctyp *>(cpyres.src),}; diff --git a/zp/include/zp/mem.d/memequ.ii b/zp/include/zp/mem.d/memequ.ii index 08f6706..ac798d0 100644 --- a/zp/include/zp/mem.d/memequ.ii +++ b/zp/include/zp/mem.d/memequ.ii @@ -4,6 +4,6 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -template<typename ltyp,typename rtyp> inline auto ::zp::memequ(ltyp const * lbuf,rtyp const * rbuf,::zp::sz const num) noexcept -> bool { +template<typename ltyp,typename rtyp> inline auto ::zp::memequ(ltyp const * lbuf,rtyp const * rbuf,::zp::sz const num) zp_prv_nthrw -> bool { return ::zp_memequ(lbuf,rbuf,num); } diff --git a/zp/include/zp/mem.d/memfil.ii b/zp/include/zp/mem.d/memfil.ii index 4c8d810..66b8216 100644 --- a/zp/include/zp/mem.d/memfil.ii +++ b/zp/include/zp/mem.d/memfil.ii @@ -4,6 +4,6 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -template<typename typ> inline auto ::zp::memfil(typ * dst,char unsigned const val,::zp::sz const num) noexcept -> typ * { +template<typename typ> inline auto ::zp::memfil(typ * dst,char unsigned const val,::zp::sz const num) zp_prv_nthrw -> typ * { return static_cast<typ *>(::zp_memfil(dst,val,num)); } diff --git a/zp/include/zp/mem.d/memsrh.ii b/zp/include/zp/mem.d/memsrh.ii index de6fbb1..4040a4f 100644 --- a/zp/include/zp/mem.d/memsrh.ii +++ b/zp/include/zp/mem.d/memsrh.ii @@ -4,10 +4,10 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -template<typename typ> inline auto ::zp::memsrh(typ * buf,char unsigned const val,::zp::sz const num) noexcept -> typ * { +template<typename typ> inline auto ::zp::memsrh(typ * buf,char unsigned const val,::zp::sz const num) zp_prv_nthrw -> typ * { return static_cast<typ *>(::zp_memsrh(buf,val,num)); } -template<typename typ> inline auto ::zp::memsrh(typ const * buf,char unsigned const val,::zp::sz const num) noexcept -> typ const * { +template<typename typ> inline auto ::zp::memsrh(typ const * buf,char unsigned const val,::zp::sz const num) zp_prv_nthrw -> typ const * { return const_cast<typ const *>(static_cast<typ *>(::zp_memsrh(buf,val,num))); } diff --git a/zp/include/zp/mem.d/srh.ii b/zp/include/zp/mem.d/srh.ii index c8540df..c887fdf 100644 --- a/zp/include/zp/mem.d/srh.ii +++ b/zp/include/zp/mem.d/srh.ii @@ -4,11 +4,11 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -template<typename typ> constexpr auto ::zp::srh(typ * buf,typ val,::zp::sz const num) noexcept -> typ * { +template<typename typ> zp_prv_constexpr auto ::zp::srh(typ * buf,typ val,::zp::sz const num) zp_prv_nthrw -> typ * { return const_cast<typ *>(::zp::srh(const_cast<typ const *>(buf),val,num)); } -template<typename typ> constexpr auto ::zp::srh(typ const * buf,typ const val,::zp::sz const num) noexcept -> typ const * { +template<typename typ> zp_prv_constexpr auto ::zp::srh(typ const * buf,typ const val,::zp::sz const num) zp_prv_nthrw -> typ const * { typ const * const stp = buf+num; while (buf != stp) { diff --git a/zp/include/zp/mem.h b/zp/include/zp/mem.h index 1205f72..18dc4fd 100644 --- a/zp/include/zp/mem.h +++ b/zp/include/zp/mem.h @@ -4,12 +4,12 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -#ifndef zp_priv_hdr_mem -#define zp_priv_hdr_mem +#ifndef zp_prv_hdr_mem +#define zp_prv_hdr_mem #include <zp/bs.h> -zp_priv_cdecl +zp_prv_cdecl struct zp_cpyres { void * dst; @@ -21,6 +21,6 @@ zp_nthrw zp_useres bool zp_memequ(void const * lbuf,void co zp_nthrw void * zp_memfil(void * dst, char unsigned val, zp_sz num); zp_nthrw zp_useres void * zp_memsrh(void const * buf, char unsigned val, zp_sz num); -zp_priv_cdeclend +zp_prv_cdeclend #endif diff --git a/zp/include/zp/mth b/zp/include/zp/mth index 0326131..d2400e3 100644 --- a/zp/include/zp/mth +++ b/zp/include/zp/mth @@ -4,31 +4,26 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -#ifndef zp_priv_cxxhdr_mth -#define zp_priv_cxxhdr_mth +#ifndef zp_prv_cxxhdr_mth +#define zp_prv_cxxhdr_mth #include <zp/bs> #include <zp/mth.h> namespace zp { - namespace det { - template<typename typ> struct inf {constexpr static auto val = ::zp::maxval<typ>;}; - - template<> struct inf<double> {constexpr static auto val = zp_inff;}; - template<> struct inf<float> {constexpr static auto val = zp_infd;}; - template<> struct inf<long double> {constexpr static auto val = zp_infld;}; + template<typename typ> struct inf {constexpr static auto val = ::zp::maxval<typ>::val;}; - template<typename typ> struct nan {constexpr static auto val = typ {0x0};}; + template<> struct inf<double> {constexpr static auto val = zp_inff;}; + template<> struct inf<float> {constexpr static auto val = zp_infd;}; + template<> struct inf<long double> {constexpr static auto val = zp_infld;}; - template<> struct nan<double> {constexpr static auto val = zp_nanf;}; - template<> struct nan<float> {constexpr static auto val = zp_nand;}; - template<> struct nan<long double> {constexpr static auto val = zp_nanld;}; - } + template<typename typ> struct nan {constexpr static auto val = typ {0x0};}; - template<typename typ> constexpr auto inf = ::zp::det::inf<typ>::val; - template<typename typ> constexpr auto nan = ::zp::det::nan<typ>::val; + template<> struct nan<double> {constexpr static auto val = zp_nanf;}; + template<> struct nan<float> {constexpr static auto val = zp_nand;}; + template<> struct nan<long double> {constexpr static auto val = zp_nanld;}; - namespace det { + namespace prv { template<typename ityp> struct cpairtyp {using typ = void;}; template<> struct cpairtyp<char signed> {using typ = ::zp_pairsc;}; @@ -40,12 +35,12 @@ namespace zp { template<typename typ> class pair { public: - using ctyp = typename ::zp::det::cpairtyp<typ>::typ; + using ctyp = typename ::zp::prv::cpairtyp<typ>::typ; typ lval; typ rval; - constexpr auto cpair() const noexcept -> ctyp; + zp_prv_constexpr auto cpair() const zp_prv_nthrw -> ctyp; }; namespace det { @@ -75,7 +70,7 @@ namespace zp { typ x; typ y; - constexpr auto cvec() const noexcept -> ctyp; + zp_prv_constexpr auto cvec() const zp_prv_nthrw -> ctyp; }; template<typename typ> class vec3 { public: @@ -85,7 +80,7 @@ namespace zp { typ y; typ z; - constexpr auto cvec() const noexcept -> ctyp; + zp_prv_constexpr auto cvec() const zp_prv_nthrw -> ctyp; }; template<typename typ> class vec4 { public: @@ -96,60 +91,60 @@ namespace zp { typ z; typ w; - constexpr auto cvec() const noexcept -> ctyp; + zp_prv_constexpr auto cvec() const zp_prv_nthrw -> ctyp; }; - template<typename typ> constexpr auto abs(typ val) noexcept -> ::zp::usgn<typ>; + template<typename typ> zp_prv_constexpr auto abs(typ val) zp_prv_nthrw -> typename ::zp::usgn<typ>::typ; - template<typename typ> constexpr auto acos(typ val) noexcept -> typ; + template<typename typ> zp_prv_constexpr auto acos(typ val) zp_prv_nthrw -> typ; - template<typename typ> constexpr auto asin(typ val) noexcept -> typ; + template<typename typ> zp_prv_constexpr auto asin(typ val) zp_prv_nthrw -> typ; - template<typename typ> constexpr auto atan(typ val) noexcept -> typ; + template<typename typ> zp_prv_constexpr auto atan(typ val) zp_prv_nthrw -> typ; - template<typename typ> constexpr auto cbrt(typ val) noexcept -> typ; + template<typename typ> zp_prv_constexpr auto cbrt(typ val) zp_prv_nthrw -> typ; - template<typename typ> constexpr auto cos(typ val) noexcept -> typ; + template<typename typ> zp_prv_constexpr auto cos(typ val) zp_prv_nthrw -> typ; - template<typename typ> constexpr auto dist(typ x,typ y) noexcept -> typ; - template<typename typ> constexpr auto dist(typ x,typ y,typ z) noexcept -> typ; - template<typename typ> constexpr auto dist(typ x,typ y,typ z,typ w) noexcept -> typ; + template<typename typ> zp_prv_constexpr auto dist(typ x,typ y) zp_prv_nthrw -> typ; + template<typename typ> zp_prv_constexpr auto dist(typ x,typ y,typ z) zp_prv_nthrw -> typ; + template<typename typ> zp_prv_constexpr auto dist(typ x,typ y,typ z,typ w) zp_prv_nthrw -> typ; - template<typename typ> constexpr auto divmod(typ num,typ den) noexcept -> ::zp::pair<typ>; + template<typename typ> zp_prv_constexpr auto divmod(typ num,typ den) zp_prv_nthrw -> ::zp::pair<typ>; - template<typename typ> constexpr auto dot(::zp::vec2<typ> lvec,::zp::vec2<typ> rvec) noexcept -> typ; - template<typename typ> constexpr auto dot(::zp::vec3<typ> lvec,::zp::vec3<typ> rvec) noexcept -> typ; - template<typename typ> constexpr auto dot(::zp::vec4<typ> lvec,::zp::vec4<typ> rvec) noexcept -> typ; + template<typename typ> zp_prv_constexpr auto dot(::zp::vec2<typ> lvec,::zp::vec2<typ> rvec) zp_prv_nthrw -> typ; + template<typename typ> zp_prv_constexpr auto dot(::zp::vec3<typ> lvec,::zp::vec3<typ> rvec) zp_prv_nthrw -> typ; + template<typename typ> zp_prv_constexpr auto dot(::zp::vec4<typ> lvec,::zp::vec4<typ> rvec) zp_prv_nthrw -> typ; - template<typename typ> constexpr auto exp(typ val,typ n) noexcept -> typ; + template<typename typ> zp_prv_constexpr auto exp(typ val,typ n) zp_prv_nthrw -> typ; - template<typename typ> constexpr auto isnan(typ val) noexcept -> bool; + template<typename typ> zp_prv_constexpr auto isnan(typ val) zp_prv_nthrw -> bool; - template<typename typ> constexpr auto lb(typ val) noexcept -> typ; + template<typename typ> zp_prv_constexpr auto lb(typ val) zp_prv_nthrw -> typ; - template<typename typ> constexpr auto lg(typ val) noexcept -> typ; + template<typename typ> zp_prv_constexpr auto lg(typ val) zp_prv_nthrw -> typ; - template<typename typ> constexpr auto ln(typ val) noexcept -> typ; + template<typename typ> zp_prv_constexpr auto ln(typ val) zp_prv_nthrw -> typ; - template<typename typ> constexpr auto log(typ val) noexcept -> typ; + template<typename typ> zp_prv_constexpr auto log(typ val) zp_prv_nthrw -> typ; - template<typename typ> constexpr auto nrt(typ val) noexcept -> typ; + template<typename typ> zp_prv_constexpr auto nrt(typ val) zp_prv_nthrw -> typ; - template<typename typ> constexpr auto sin(typ val) noexcept -> typ; + template<typename typ> zp_prv_constexpr auto sin(typ val) zp_prv_nthrw -> typ; - template<typename typ> constexpr auto sqrt(typ val) noexcept -> typ; + template<typename typ> zp_prv_constexpr auto sqrt(typ val) zp_prv_nthrw -> typ; - template<typename typ> constexpr auto tan(typ val) noexcept -> typ; + template<typename typ> zp_prv_constexpr auto tan(typ val) zp_prv_nthrw -> typ; - template<typename typ> constexpr auto tsrt(typ val) noexcept -> typ; + template<typename typ> zp_prv_constexpr auto tsrt(typ val) zp_prv_nthrw -> typ; - template<typename typ> constexpr auto vadd(::zp::vec2<typ> lvec,::zp::vec2<typ> rvec) noexcept -> ::zp::vec2<typ>; - template<typename typ> constexpr auto vadd(::zp::vec3<typ> lvec,::zp::vec3<typ> rvec) noexcept -> ::zp::vec3<typ>; - template<typename typ> constexpr auto vadd(::zp::vec4<typ> lvec,::zp::vec4<typ> rvec) noexcept -> ::zp::vec4<typ>; + template<typename typ> zp_prv_constexpr auto vadd(::zp::vec2<typ> lvec,::zp::vec2<typ> rvec) zp_prv_nthrw -> ::zp::vec2<typ>; + template<typename typ> zp_prv_constexpr auto vadd(::zp::vec3<typ> lvec,::zp::vec3<typ> rvec) zp_prv_nthrw -> ::zp::vec3<typ>; + template<typename typ> zp_prv_constexpr auto vadd(::zp::vec4<typ> lvec,::zp::vec4<typ> rvec) zp_prv_nthrw -> ::zp::vec4<typ>; - template<typename typ> constexpr auto vsub(::zp::vec2<typ> lvec,::zp::vec2<typ> rvec) noexcept -> ::zp::vec2<typ>; - template<typename typ> constexpr auto vsub(::zp::vec3<typ> lvec,::zp::vec3<typ> rvec) noexcept -> ::zp::vec3<typ>; - template<typename typ> constexpr auto vsub(::zp::vec4<typ> lvec,::zp::vec4<typ> rvec) noexcept -> ::zp::vec4<typ>; + template<typename typ> zp_prv_constexpr auto vsub(::zp::vec2<typ> lvec,::zp::vec2<typ> rvec) zp_prv_nthrw -> ::zp::vec2<typ>; + template<typename typ> zp_prv_constexpr auto vsub(::zp::vec3<typ> lvec,::zp::vec3<typ> rvec) zp_prv_nthrw -> ::zp::vec3<typ>; + template<typename typ> zp_prv_constexpr auto vsub(::zp::vec4<typ> lvec,::zp::vec4<typ> rvec) zp_prv_nthrw -> ::zp::vec4<typ>; } #include <zp/mth.d/pair/cpair.ii> diff --git a/zp/include/zp/mth.d/abs.ii b/zp/include/zp/mth.d/abs.ii index 3e51f46..5a8fb48 100644 --- a/zp/include/zp/mth.d/abs.ii +++ b/zp/include/zp/mth.d/abs.ii @@ -4,10 +4,10 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -template<typename typ> constexpr auto ::zp::abs(typ const val) noexcept -> ::zp::usgn<typ> { - static_assert(::zp::isarith<typ>,"type must be an arithmetic type"); +template<typename typ> zp_prv_constexpr auto ::zp::abs(typ const val) zp_prv_nthrw -> typename ::zp::usgn<typ>::typ { + static_assert(::zp::isari<typ>::val,"type must be an arithmetic type"); - using newtyp = ::zp::usgn<typ>; // If a floating-point type was used, the new type would be identical. + using newtyp = typename ::zp::usgn<typ>::typ; // If a floating-point type was used, the new type would be identical. if (val > typ {0x0}) return static_cast<newtyp>(val); diff --git a/zp/include/zp/mth.d/dist.ii b/zp/include/zp/mth.d/dist.ii index e835c42..13c6a5e 100644 --- a/zp/include/zp/mth.d/dist.ii +++ b/zp/include/zp/mth.d/dist.ii @@ -4,20 +4,20 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -/*template<typename typ> constexpr auto ::zp::dist(typ const x,typ const y) noexcept -> typ { - static_assert(::zp::isarith<typ>,"type must be an arithmetic type"); +/*template<typename typ> zp_prv_constexpr auto ::zp::dist(typ const x,typ const y) zp_prv_nthrw -> typ { + static_assert(::zp::isari<typ>::val,"type must be an arithmetic type"); return ::zp::sqrt(x*x+y*y); } -template<typename typ> constexpr auto ::zp::dist(typ const x,typ const y,typ const z) noexcept -> typ { - static_assert(::zp::isarith<typ>,"type must be an arithmetic type"); +template<typename typ> zp_prv_constexpr auto ::zp::dist(typ const x,typ const y,typ const z) zp_prv_nthrw -> typ { + static_assert(::zp::isari<typ>::val,"type must be an arithmetic type"); return ::zp::cbrt(x*x+y*y+z*z); } -template<typename typ> constexpr auto ::zp::dist(typ const x,typ const y,typ const z,typ const w) noexcept -> typ { - static_assert(::zp::isarith<typ>,"type must be an arithmetic type"); +template<typename typ> zp_prv_constexpr auto ::zp::dist(typ const x,typ const y,typ const z,typ const w) zp_prv_nthrw -> typ { + static_assert(::zp::isari<typ>::val,"type must be an arithmetic type"); return ::zp::tsrt(x*x+y*y+z*z+w*w); }*/ diff --git a/zp/include/zp/mth.d/divmod.ii b/zp/include/zp/mth.d/divmod.ii index 1a83e64..22044d9 100644 --- a/zp/include/zp/mth.d/divmod.ii +++ b/zp/include/zp/mth.d/divmod.ii @@ -4,13 +4,13 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -template<typename typ> constexpr auto ::zp::divmod(typ const num,typ const den) noexcept -> ::zp::pair<typ> { - static_assert(::zp::isint<typ>,"type must be an integral type"); +template<typename typ> zp_prv_constexpr auto ::zp::divmod(typ const num,typ const den) zp_prv_nthrw -> ::zp::pair<typ> { + static_assert(::zp::isint<typ>::val,"type must be an integral type"); ::zp::pair<typ> pair; zp_ulik (den == 0x0) { - pair.lval = ::zp::inf<typ>; + pair.lval = ::zp::inf<typ>::val; pair.rval = pair.lval; return pair; diff --git a/zp/include/zp/mth.d/dot.ii b/zp/include/zp/mth.d/dot.ii index 0761379..d9e0c9c 100644 --- a/zp/include/zp/mth.d/dot.ii +++ b/zp/include/zp/mth.d/dot.ii @@ -4,20 +4,20 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -template<typename typ> constexpr auto ::zp::dot(::zp::vec2<typ> const lvec,::zp::vec2<typ> const rvec) noexcept -> typ { - static_assert(::zp::isarith<typ>,"type must be an arithmetic type"); +template<typename typ> zp_prv_constexpr auto ::zp::dot(::zp::vec2<typ> const lvec,::zp::vec2<typ> const rvec) zp_prv_nthrw -> typ { + static_assert(::zp::isari<typ>::val,"type must be an arithmetic type"); return lvec.x*rvec.x+lvec.y*rvec.y; } -template<typename typ> constexpr auto ::zp::dot(::zp::vec3<typ> const lvec,::zp::vec3<typ> const rvec) noexcept -> typ { - static_assert(::zp::isarith<typ>,"type must be an arithmetic type"); +template<typename typ> zp_prv_constexpr auto ::zp::dot(::zp::vec3<typ> const lvec,::zp::vec3<typ> const rvec) zp_prv_nthrw -> typ { + static_assert(::zp::isari<typ>::val,"type must be an arithmetic type"); return lvec.x*rvec.x+lvec.y*rvec.y+lvec.z*rvec.z; } -template<typename typ> constexpr auto ::zp::dot(::zp::vec4<typ> const lvec,::zp::vec4<typ> const rvec) noexcept -> typ { - static_assert(::zp::isarith<typ>,"type must be an arithmetic type"); +template<typename typ> zp_prv_constexpr auto ::zp::dot(::zp::vec4<typ> const lvec,::zp::vec4<typ> const rvec) zp_prv_nthrw -> typ { + static_assert(::zp::isari<typ>::val,"type must be an arithmetic type"); return lvec.x*rvec.x+lvec.y*rvec.y+lvec.z*rvec.z+lvec.w*rvec.w; } diff --git a/zp/include/zp/mth.d/exp.ii b/zp/include/zp/mth.d/exp.ii index 6612cb3..a86b128 100644 --- a/zp/include/zp/mth.d/exp.ii +++ b/zp/include/zp/mth.d/exp.ii @@ -4,8 +4,8 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -template<typename typ> constexpr auto ::zp::exp(typ const val,typ const n) noexcept -> typ { - static_assert(::zp::isarith<typ>,"type must be an arithmetic type"); +template<typename typ> zp_prv_constexpr auto ::zp::exp(typ const val,typ const n) zp_prv_nthrw -> typ { + static_assert(::zp::isari<typ>::val,"type must be an arithmetic type"); zp_ulik (n == typ {0x0}) { return typ {0x1}; diff --git a/zp/include/zp/mth.d/isnan.ii b/zp/include/zp/mth.d/isnan.ii index fd43b1f..f52dde4 100644 --- a/zp/include/zp/mth.d/isnan.ii +++ b/zp/include/zp/mth.d/isnan.ii @@ -4,12 +4,10 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -template<typename typ> constexpr auto ::zp::isnan(typ const val) noexcept -> bool { - static_assert(::zp::isarith<typ>,"type must be an arithmetic type"); +template<typename typ> zp_prv_constexpr auto ::zp::isnan(typ const val) zp_prv_nthrw -> bool { + static_assert(::zp::isari<typ>::val,"type must be an arithmetic type"); - if (::zp::isflt<typ>) { - return val != val; - } + if (::zp::isint<typ>::val) {return false;} - return false; + return val != val; } diff --git a/zp/include/zp/mth.d/pair/cpair.ii b/zp/include/zp/mth.d/pair/cpair.ii index 1f98c32..44611e0 100644 --- a/zp/include/zp/mth.d/pair/cpair.ii +++ b/zp/include/zp/mth.d/pair/cpair.ii @@ -4,7 +4,7 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -template<typename typ> constexpr auto ::zp::pair<typ>::cpair() const noexcept -> ::zp::pair<typ>::ctyp { +template<typename typ> zp_prv_constexpr auto ::zp::pair<typ>::cpair() const zp_prv_nthrw -> ::zp::pair<typ>::ctyp { return ::zp::pair<typ>::ctyp { this->lval, this->rval, diff --git a/zp/include/zp/mth.d/vadd.ii b/zp/include/zp/mth.d/vadd.ii index b047ba2..8d56224 100644 --- a/zp/include/zp/mth.d/vadd.ii +++ b/zp/include/zp/mth.d/vadd.ii @@ -4,8 +4,8 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -template<typename typ> constexpr auto ::zp::vadd(::zp::vec2<typ> const lvec,::zp::vec2<typ> const rvec) noexcept -> ::zp::vec2<typ> { - static_assert(::zp::isarith<typ>,"type must be an arithmetic type"); +template<typename typ> zp_prv_constexpr auto ::zp::vadd(::zp::vec2<typ> const lvec,::zp::vec2<typ> const rvec) zp_prv_nthrw -> ::zp::vec2<typ> { + static_assert(::zp::isari<typ>::val,"type must be an arithmetic type"); return ::zp::vec2<typ> { lvec.x+rvec.x, @@ -13,8 +13,8 @@ template<typename typ> constexpr auto ::zp::vadd(::zp::vec2<typ> const lvec,::zp }; } -template<typename typ> constexpr auto ::zp::vadd(::zp::vec3<typ> const lvec,::zp::vec3<typ> const rvec) noexcept -> ::zp::vec3<typ> { - static_assert(::zp::isarith<typ>,"type must be an arithmetic type"); +template<typename typ> zp_prv_constexpr auto ::zp::vadd(::zp::vec3<typ> const lvec,::zp::vec3<typ> const rvec) zp_prv_nthrw -> ::zp::vec3<typ> { + static_assert(::zp::isari<typ>::val,"type must be an arithmetic type"); return ::zp::vec3<typ> { lvec.x+rvec.x, @@ -23,8 +23,8 @@ template<typename typ> constexpr auto ::zp::vadd(::zp::vec3<typ> const lvec,::zp }; } -template<typename typ> constexpr auto ::zp::vadd(::zp::vec4<typ> const lvec,::zp::vec4<typ> const rvec) noexcept -> ::zp::vec4<typ> { - static_assert(::zp::isarith<typ>,"type must be an arithmetic type"); +template<typename typ> zp_prv_constexpr auto ::zp::vadd(::zp::vec4<typ> const lvec,::zp::vec4<typ> const rvec) zp_prv_nthrw -> ::zp::vec4<typ> { + static_assert(::zp::isari<typ>::val,"type must be an arithmetic type"); return ::zp::vec4<typ> { lvec.x+rvec.x, diff --git a/zp/include/zp/mth.d/vec2/cvec.ii b/zp/include/zp/mth.d/vec2/cvec.ii index a784de9..6fa656e 100644 --- a/zp/include/zp/mth.d/vec2/cvec.ii +++ b/zp/include/zp/mth.d/vec2/cvec.ii @@ -4,7 +4,7 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -template<typename typ> constexpr auto ::zp::vec2<typ>::cvec() const noexcept -> ::zp::vec2<typ>::ctyp { +template<typename typ> zp_prv_constexpr auto ::zp::vec2<typ>::cvec() const zp_prv_nthrw -> ::zp::vec2<typ>::ctyp { return typename ::zp::vec2<typ>::ctyp { this->x, this->y, diff --git a/zp/include/zp/mth.d/vec3/cvec.ii b/zp/include/zp/mth.d/vec3/cvec.ii index d4a294c..5020692 100644 --- a/zp/include/zp/mth.d/vec3/cvec.ii +++ b/zp/include/zp/mth.d/vec3/cvec.ii @@ -4,7 +4,7 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -template<typename typ> constexpr auto ::zp::vec3<typ>::cvec() const noexcept -> ::zp::vec3<typ>::ctyp { +template<typename typ> zp_prv_constexpr auto ::zp::vec3<typ>::cvec() const zp_prv_nthrw -> ::zp::vec3<typ>::ctyp { return typename ::zp::vec3<typ>::ctyp { this->x, this->y, diff --git a/zp/include/zp/mth.d/vec4/cvec.ii b/zp/include/zp/mth.d/vec4/cvec.ii index 107bb5e..2c7154c 100644 --- a/zp/include/zp/mth.d/vec4/cvec.ii +++ b/zp/include/zp/mth.d/vec4/cvec.ii @@ -4,7 +4,7 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -template<typename typ> constexpr auto ::zp::vec4<typ>::cvec() const noexcept -> ::zp::vec4<typ>::ctyp { +template<typename typ> zp_prv_constexpr auto ::zp::vec4<typ>::cvec() const zp_prv_nthrw -> ::zp::vec4<typ>::ctyp { return typename ::zp::vec4<typ>::ctyp { this->x, this->y, diff --git a/zp/include/zp/mth.d/vsub.ii b/zp/include/zp/mth.d/vsub.ii index 7230937..2f63d76 100644 --- a/zp/include/zp/mth.d/vsub.ii +++ b/zp/include/zp/mth.d/vsub.ii @@ -4,8 +4,8 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -template<typename typ> constexpr auto ::zp::vsub(::zp::vec2<typ> const lvec,::zp::vec2<typ> const rvec) noexcept -> ::zp::vec2<typ> { - static_assert(::zp::isarith<typ>,"type must be an arithmetic type"); +template<typename typ> zp_prv_constexpr auto ::zp::vsub(::zp::vec2<typ> const lvec,::zp::vec2<typ> const rvec) zp_prv_nthrw -> ::zp::vec2<typ> { + static_assert(::zp::isari<typ>::val,"type must be an arithmetic type"); return ::zp::vec2<typ> { lvec.x-rvec.x, @@ -13,8 +13,8 @@ template<typename typ> constexpr auto ::zp::vsub(::zp::vec2<typ> const lvec,::zp }; } -template<typename typ> constexpr auto ::zp::vsub(::zp::vec3<typ> const lvec,::zp::vec3<typ> const rvec) noexcept -> ::zp::vec3<typ> { - static_assert(::zp::isarith<typ>,"type must be an arithmetic type"); +template<typename typ> zp_prv_constexpr auto ::zp::vsub(::zp::vec3<typ> const lvec,::zp::vec3<typ> const rvec) zp_prv_nthrw -> ::zp::vec3<typ> { + static_assert(::zp::isari<typ>::val,"type must be an arithmetic type"); return ::zp::vec3<typ> { lvec.x-rvec.x, @@ -23,8 +23,8 @@ template<typename typ> constexpr auto ::zp::vsub(::zp::vec3<typ> const lvec,::zp }; } -template<typename typ> constexpr auto ::zp::vsub(::zp::vec4<typ> const lvec,::zp::vec4<typ> const rvec) noexcept -> ::zp::vec4<typ> { - static_assert(::zp::isarith<typ>,"type must be an arithmetic type"); +template<typename typ> zp_prv_constexpr auto ::zp::vsub(::zp::vec4<typ> const lvec,::zp::vec4<typ> const rvec) zp_prv_nthrw -> ::zp::vec4<typ> { + static_assert(::zp::isari<typ>::val,"type must be an arithmetic type"); return ::zp::vec4<typ> { lvec.x-rvec.x, diff --git a/zp/include/zp/mth.h b/zp/include/zp/mth.h index 3a4f79c..8e1ec1e 100644 --- a/zp/include/zp/mth.h +++ b/zp/include/zp/mth.h @@ -4,40 +4,40 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -#ifndef zp_priv_hdr_mth -#define zp_priv_hdr_mth +#ifndef zp_prv_hdr_mth +#define zp_prv_hdr_mth #include <zp/bs.h> -zp_priv_cdecl +zp_prv_cdecl -#if zp_priv_hasbuiltin(__builtin_huge_val) +#if zp_prv_hasbuiltin(__builtin_huge_val) #define zp_infd (__builtin_huge_val()) #else #define zp_infd (0.0); #endif -#if zp_priv_hasbuiltin(__builtin_huge_valf) +#if zp_prv_hasbuiltin(__builtin_huge_valf) #define zp_inff (__builtin_huge_valf()) #else #define zp_inff (0.0f); #endif -#if zp_priv_hasbuiltin(__builtin_huge_vall) +#if zp_prv_hasbuiltin(__builtin_huge_vall) #define zp_infld (__builtin_huge_vall()) #else #define zp_infld (0.0l); #endif -#if zp_priv_hasbuiltin(__builtin_nan) +#if zp_prv_hasbuiltin(__builtin_nan) #define zp_nand (__builtin_nan("")) #else #define zp_nand (0.0); #endif -#if zp_priv_hasbuiltin(__builtin_nanf) +#if zp_prv_hasbuiltin(__builtin_nanf) #define zp_nanf (__builtin_nanf("")) #else #define zp_nanf (0.0f); #endif -#if zp_priv_hasbuiltin(__builtin_nanl) +#if zp_prv_hasbuiltin(__builtin_nanl) #define zp_nanld (__builtin_nanl("")) #else #define zp_nanld (0.0l); @@ -274,6 +274,6 @@ zp_nthrw zp_useq zp_useres zp_vec4f zp_v4subf( zp_vec4f lvec,zp_vec4f rvec); zp_nthrw zp_useq zp_useres zp_vec4d zp_v4subd( zp_vec4d lvec,zp_vec4d rvec); zp_nthrw zp_useq zp_useres zp_vec4ld zp_v4subld(zp_vec4ld lvec,zp_vec4ld rvec); -zp_priv_cdeclend +zp_prv_cdeclend #endif diff --git a/zp/include/zp/priv/arc.h b/zp/include/zp/prv/arc.h index 19a39f8..19a39f8 100644 --- a/zp/include/zp/priv/arc.h +++ b/zp/include/zp/prv/arc.h diff --git a/zp/include/zp/priv/chr.h b/zp/include/zp/prv/chr.h index 5954b33..5f649f7 100644 --- a/zp/include/zp/priv/chr.h +++ b/zp/include/zp/prv/chr.h @@ -49,27 +49,27 @@ #define zp_minvalw ((zp_wchr)+zp_minvalsu) #define zp_maxvalw ((zp_wchr)+zp_maxvalsu) -typedef short unsigned zp_priv_wchr; +typedef short unsigned zp_prv_wchr; #else #if zp_uchr #define zp_minvalw ((zp_wchr)+zp_minvaliu) #define zp_maxvalw ((zp_wchr)+zp_maxvaliu) -typedef int unsigned zp_priv_wchr; +typedef int unsigned zp_prv_wchr; #else #define zp_minvalw ((zp_wchr)+zp_minvali) #define zp_maxvalw ((zp_wchr)+zp_maxvali) -typedef int zp_priv_wchr; +typedef int zp_prv_wchr; #endif #endif #ifdef zp_std_cxx typedef wchar_t zp_wchr; #else -typedef zp_priv_wchr zp_wchr; +typedef zp_prv_wchr zp_wchr; #endif #define zp_minvalc8 ((zp_c8)+zp_minvalcu) diff --git a/zp/include/zp/priv/flt.h b/zp/include/zp/prv/flt.h index 83b0abe..d952881 100644 --- a/zp/include/zp/priv/flt.h +++ b/zp/include/zp/prv/flt.h @@ -83,47 +83,47 @@ #define zp_fixflt02 (0x1) #define zp_minvalf02 zp_minvalf #define zp_maxvalf02 zp_maxvalf -typedef float zp_priv_f02; +typedef float zp_prv_f02; #define zp_fixflt04 (0x1) #define zp_minvalf04 zp_minvald #define zp_maxvalf04 zp_maxvald -typedef double zp_priv_f04; +typedef double zp_prv_f04; #if \ zp_arc_arm64 // x86 jealous :( #define zp_fixflt08 (0x1) -typedef long double zp_priv_f08; +typedef long double zp_prv_f08; #elif \ __FLOAT128__ \ || __SIZEOF_FLOAT128__ #define zp_fixflt08 (0x1) -zp_priv_ext typedef __float128 zp_priv_f08; +zp_prv_ext typedef __float128 zp_prv_f08; #endif #if zp_std_c #if zp_fixflt01 -typedef zp_priv_f01 zp_f01; +typedef zp_prv_f01 zp_f01; #endif #if zp_fixflt02 -typedef zp_priv_f02 zp_f02; +typedef zp_prv_f02 zp_f02; #endif #if zp_fixflt04 -typedef zp_priv_f04 zp_f04; +typedef zp_prv_f04 zp_f04; #endif #if zp_fixflt08 -typedef zp_priv_f08 zp_f08; +typedef zp_prv_f08 zp_f08; #endif #elif zp_std_cxx #if zp_fixflt01 -typedef zp_priv_f01 zp_f01; +typedef zp_prv_f01 zp_f01; #elif __STDCPP_FLOAT16_T__ @@ -134,7 +134,7 @@ typedef decltype (0.0f16) zp_f01; #if zp_fixflt02 -typedef zp_priv_f02 zp_f02; +typedef zp_prv_f02 zp_f02; #elif __STDCPP_FLOAT32_T__ @@ -145,7 +145,7 @@ typedef decltype (0.0f32) zp_f02; #if zp_fixflt04 -typedef zp_priv_f04 zp_f04; +typedef zp_prv_f04 zp_f04; #elif __STDCPP_FLOAT64_T__ @@ -156,7 +156,7 @@ typedef decltype (0.0f64) zp_f04; #if zp_fixflt08 -typedef zp_priv_f08 zp_f08; +typedef zp_prv_f08 zp_f08; #elif __STDCPP_FLOAT128_T__ diff --git a/zp/include/zp/priv/imp.h b/zp/include/zp/prv/imp.h index 200ae8e..200ae8e 100644 --- a/zp/include/zp/priv/imp.h +++ b/zp/include/zp/prv/imp.h diff --git a/zp/include/zp/priv/int.h b/zp/include/zp/prv/int.h index a68b738..b564556 100644 --- a/zp/include/zp/priv/int.h +++ b/zp/include/zp/prv/int.h @@ -215,8 +215,8 @@ typedef zp_i04s zp_i04ms; || __SIZEOF_INT128__ #define zp_fixint08 (0x1) -zp_priv_ext typedef __int128 unsigned zp_i08; -zp_priv_ext typedef __int128 zp_i08s; +zp_prv_ext typedef __int128 unsigned zp_i08; +zp_prv_ext typedef __int128 zp_i08s; #endif diff --git a/zp/include/zp/priv/std.h b/zp/include/zp/prv/std.h index 9062cea..9062cea 100644 --- a/zp/include/zp/priv/std.h +++ b/zp/include/zp/prv/std.h diff --git a/zp/include/zp/priv/sys.h b/zp/include/zp/prv/sys.h index dec3ca7..dec3ca7 100644 --- a/zp/include/zp/priv/sys.h +++ b/zp/include/zp/prv/sys.h diff --git a/zp/include/zp/str b/zp/include/zp/str index d601928..1841a6a 100644 --- a/zp/include/zp/str +++ b/zp/include/zp/str @@ -4,38 +4,38 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -#ifndef zp_priv_cxxhdr_str -#define zp_priv_cxxhdr_str +#ifndef zp_prv_cxxhdr_str +#define zp_prv_cxxhdr_str #include <zp/bs> #include <zp/str.h> namespace zp { - namespace priv { - template<typename typ> zp_useres constexpr auto numdig(typ val,::zp::i8m bs) noexcept -> ::zp::sz; + namespace prv { + template<typename typ> zp_useres zp_prv_constexpr auto numdig(typ val,::zp::i8m bs) zp_prv_nthrw -> ::zp::sz; } - template<typename typ> constexpr auto strcpy(typ * dst, typ const * src) noexcept -> ::zp::sz; - template<typename typ> zp_useres constexpr auto strequ(typ const * lstr,typ const * rstr) noexcept -> bool; - template<typename typ> constexpr auto strlen(typ const * str) noexcept -> ::zp::sz; - template<typename typ> zp_useres constexpr auto strsrh(typ * str, typ chr) noexcept -> typ *; - template<typename typ> zp_useres constexpr auto strsrh(typ const * str, typ chr) noexcept -> typ const *; + template<typename typ> zp_prv_constexpr auto strcpy(typ * dst, typ const * src) zp_prv_nthrw -> ::zp::sz; + template<typename typ> zp_useres zp_prv_constexpr auto strequ(typ const * lstr,typ const * rstr) zp_prv_nthrw -> bool; + template<typename typ> zp_prv_constexpr auto strlen(typ const * str) zp_prv_nthrw -> ::zp::sz; + template<typename typ> zp_useres zp_prv_constexpr auto strsrh(typ * str, typ chr) zp_prv_nthrw -> typ *; + template<typename typ> zp_useres zp_prv_constexpr auto strsrh(typ const * str, typ chr) zp_prv_nthrw -> typ const *; - zp_useres constexpr auto utf8enclen( ::zp::c02 const * str) noexcept -> ::zp::sz; - zp_useres constexpr auto utf8declen( ::zp::c8 const * str) noexcept -> ::zp::sz; - zp_useres constexpr auto utf16enclen(::zp::c02 const * str) noexcept -> ::zp::sz; - zp_useres constexpr auto utf16declen(::zp::c01 const * str) noexcept -> ::zp::sz; + zp_useres zp_prv_constexpr auto utf8enclen( ::zp::c02 const * str) zp_prv_nthrw -> ::zp::sz; + zp_useres zp_prv_constexpr auto utf8declen( ::zp::c8 const * str) zp_prv_nthrw -> ::zp::sz; + zp_useres zp_prv_constexpr auto utf16enclen(::zp::c02 const * str) zp_prv_nthrw -> ::zp::sz; + zp_useres zp_prv_constexpr auto utf16declen(::zp::c01 const * str) zp_prv_nthrw -> ::zp::sz; - constexpr auto utf8enc( ::zp::c8 * dst,::zp::c02 const * src) noexcept -> void; - constexpr auto utf8dec( ::zp::c02 * dst,::zp::c8 const * src) noexcept -> void; - constexpr auto utf16enc( ::zp::c01 * dst,::zp::c02 const * src) noexcept -> void; - constexpr auto utf16dec( ::zp::c02 * dst,::zp::c01 const * src) noexcept -> void; - constexpr auto win1252enc(::zp::c8 * dst,::zp::c02 const * src) noexcept -> void; - constexpr auto win1252dec(::zp::c02 * dst,::zp::c8 const * src) noexcept -> void; + zp_prv_constexpr auto utf8enc( ::zp::c8 * dst,::zp::c02 const * src) zp_prv_nthrw -> void; + zp_prv_constexpr auto utf8dec( ::zp::c02 * dst,::zp::c8 const * src) zp_prv_nthrw -> void; + zp_prv_constexpr auto utf16enc( ::zp::c01 * dst,::zp::c02 const * src) zp_prv_nthrw -> void; + zp_prv_constexpr auto utf16dec( ::zp::c02 * dst,::zp::c01 const * src) zp_prv_nthrw -> void; + zp_prv_constexpr auto win1252enc(::zp::c8 * dst,::zp::c02 const * src) zp_prv_nthrw -> void; + zp_prv_constexpr auto win1252dec(::zp::c02 * dst,::zp::c8 const * src) zp_prv_nthrw -> void; - template<typename typ> zp_useres constexpr auto fmtlen(typ val,::zp::i8m bs) noexcept -> ::zp::sz; // Including (potential) decorations. + template<typename typ> zp_useres zp_prv_constexpr auto fmtlen(typ val,::zp::i8m bs) zp_prv_nthrw -> ::zp::sz; // Including (potential) decorations. - template<typename typ> constexpr auto fmt(::zp::c02 * buf,typ val,::zp::i8m bs,bool rtl = false) noexcept -> void; + template<typename typ> zp_prv_constexpr auto fmt(::zp::c02 * buf,typ val,::zp::i8m bs,bool rtl = false) zp_prv_nthrw -> void; } #include <zp/str.d/fmt.ii> diff --git a/zp/include/zp/str.d/fmt.ii b/zp/include/zp/str.d/fmt.ii index f227551..3500b24 100644 --- a/zp/include/zp/str.d/fmt.ii +++ b/zp/include/zp/str.d/fmt.ii @@ -4,8 +4,8 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -template<typename sgntyp> constexpr auto ::zp::fmt(::zp::c02 * buf,sgntyp sgnval,::zp::i8m const bs,bool const rtl) noexcept -> void { - using typ = typename ::zp::usgn<sgntyp>; +template<typename sgntyp> zp_prv_constexpr auto ::zp::fmt(::zp::c02 * buf,sgntyp sgnval,::zp::i8m const bs,bool const rtl) zp_prv_nthrw -> void { + using typ = typename ::zp::usgn<sgntyp>::typ; ::zp::c02 const * digs = U"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; if (bs == 0xCu) digs = U"0123456789\u218A\u218B"; @@ -18,7 +18,7 @@ template<typename sgntyp> constexpr auto ::zp::fmt(::zp::c02 * buf,sgntyp sgnval typ val = static_cast<typ>(sgnval); if (rtl) { - buf += ::zp::priv::numdig(val,bs)-0x1u; + buf += ::zp::prv::numdig(val,bs)-0x1u; for (;val > 0x0u;val /= bs) *buf-- = digs[static_cast<::zp::sz>(val % static_cast<typ>(bs))]; diff --git a/zp/include/zp/str.d/fmtlen.ii b/zp/include/zp/str.d/fmtlen.ii index c1e3cb1..af47e6d 100644 --- a/zp/include/zp/str.d/fmtlen.ii +++ b/zp/include/zp/str.d/fmtlen.ii @@ -4,8 +4,8 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -template<typename typ> constexpr auto ::zp::fmtlen(typ val,::zp::i8m const bs) noexcept -> ::zp::sz { - static_assert(::zp::isint<typ>,"type must be an integral type"); +template<typename typ> zp_prv_constexpr auto ::zp::fmtlen(typ val,::zp::i8m const bs) zp_prv_nthrw -> ::zp::sz { + static_assert(::zp::isint<typ>::val,"type must be an integral type"); ::zp::sz len = 0x0u; @@ -14,7 +14,7 @@ template<typename typ> constexpr auto ::zp::fmtlen(typ val,::zp::i8m const bs) n len = 0x1u; } - len += ::zp::priv::numdig(val,bs); + len += ::zp::prv::numdig(val,bs); return len; } diff --git a/zp/include/zp/str.d/numdig.ii b/zp/include/zp/str.d/numdig.ii index 482cae8..43cd250 100644 --- a/zp/include/zp/str.d/numdig.ii +++ b/zp/include/zp/str.d/numdig.ii @@ -4,8 +4,8 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -template<typename typ> constexpr auto ::zp::priv::numdig(typ fmtval,::zp::i8m const bs) noexcept -> ::zp::sz { - static_assert(::zp::isint<typ>,"type must be an integral type"); +template<typename typ> zp_prv_constexpr auto ::zp::prv::numdig(typ fmtval,::zp::i8m const bs) zp_prv_nthrw -> ::zp::sz { + static_assert(::zp::isint<typ>::val,"type must be an integral type"); if (fmtval == typ {0x0}) return 0x1u; diff --git a/zp/include/zp/str.d/strcpy.ii b/zp/include/zp/str.d/strcpy.ii index 6f373a6..bc8b30e 100644 --- a/zp/include/zp/str.d/strcpy.ii +++ b/zp/include/zp/str.d/strcpy.ii @@ -4,8 +4,8 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -template<typename typ> constexpr auto ::zp::strcpy(typ * dst,typ const * src) noexcept -> ::zp::sz { - static_assert(::zp::ischr<typ>,"type must be a character type"); +template<typename typ> zp_prv_constexpr auto ::zp::strcpy(typ * dst,typ const * src) zp_prv_nthrw -> ::zp::sz { + static_assert(::zp::ischr<typ>::val,"type must be a character type"); auto const dstsrt = dst; diff --git a/zp/include/zp/str.d/strequ.ii b/zp/include/zp/str.d/strequ.ii index 6e7e1f4..901e36b 100644 --- a/zp/include/zp/str.d/strequ.ii +++ b/zp/include/zp/str.d/strequ.ii @@ -4,8 +4,8 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -template<typename typ> constexpr auto ::zp::strequ(typ const * lstr,typ const * rstr) noexcept -> bool { - static_assert(::zp::ischr<typ>,"type must be a character type"); +template<typename typ> zp_prv_constexpr auto ::zp::strequ(typ const * lstr,typ const * rstr) zp_prv_nthrw -> bool { + static_assert(::zp::ischr<typ>::val,"type must be a character type"); for (;;++lstr,++rstr) { zp_lik (*lstr != *rstr) {return false;} diff --git a/zp/include/zp/str.d/strlen.ii b/zp/include/zp/str.d/strlen.ii index b26765d..b77add2 100644 --- a/zp/include/zp/str.d/strlen.ii +++ b/zp/include/zp/str.d/strlen.ii @@ -4,8 +4,8 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -template<typename typ> constexpr auto ::zp::strlen(typ const * str) noexcept -> ::zp::sz { - static_assert(::zp::ischr<typ>,"type must be a character type"); // If the string format uses multiple values per character, the number of these values is returned (use utfXdeclen if the number of characters is needed). +template<typename typ> zp_prv_constexpr auto ::zp::strlen(typ const * str) zp_prv_nthrw -> ::zp::sz { + static_assert(::zp::ischr<typ>::val,"type must be a character type"); // If the string format uses multiple values per character, the number of these values is returned (use utfXdeclen if the number of characters is needed). auto const srt = str; diff --git a/zp/include/zp/str.d/strsrh.ii b/zp/include/zp/str.d/strsrh.ii index 8f30b16..a0f3798 100644 --- a/zp/include/zp/str.d/strsrh.ii +++ b/zp/include/zp/str.d/strsrh.ii @@ -4,14 +4,12 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -template<typename typ> constexpr auto ::zp::strsrh(typ * str,typ const chr) noexcept -> typ * { - static_assert(::zp::ischr<typ>,"type must be a character type"); - +template<typename typ> zp_prv_constexpr auto ::zp::strsrh(typ * str,typ const chr) zp_prv_nthrw -> typ * { return const_cast<typ *>(::zp::strsrh(const_cast<typ const *>(str),chr)); } -template<typename typ> constexpr auto ::zp::strsrh(typ const * str,typ const chr) noexcept -> typ const * { - static_assert(::zp::ischr<typ>,"type must be a character type"); +template<typename typ> zp_prv_constexpr auto ::zp::strsrh(typ const * str,typ const chr) zp_prv_nthrw -> typ const * { + static_assert(::zp::ischr<typ>::val,"type must be a character type"); for (;;++str) { auto const curchr = *str; diff --git a/zp/include/zp/str.d/utf16dec.ii b/zp/include/zp/str.d/utf16dec.ii index 143b0c2..c099a67 100644 --- a/zp/include/zp/str.d/utf16dec.ii +++ b/zp/include/zp/str.d/utf16dec.ii @@ -4,7 +4,7 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -constexpr auto ::zp::utf16dec(::zp::c02 * dst,::zp::c01 const * src) noexcept -> void { +zp_prv_constexpr auto ::zp::utf16dec(::zp::c02 * dst,::zp::c01 const * src) zp_prv_nthrw -> void { for (;;++dst) { auto const hex = *src++; diff --git a/zp/include/zp/str.d/utf16declen.ii b/zp/include/zp/str.d/utf16declen.ii index b77893b..55bb736 100644 --- a/zp/include/zp/str.d/utf16declen.ii +++ b/zp/include/zp/str.d/utf16declen.ii @@ -4,7 +4,7 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -constexpr auto ::zp::utf16declen(::zp::c01 const * str) noexcept -> ::zp::sz { +zp_prv_constexpr auto ::zp::utf16declen(::zp::c01 const * str) zp_prv_nthrw -> ::zp::sz { ::zp::sz len = 0x0u; for (;;++len) { diff --git a/zp/include/zp/str.d/utf16enc.ii b/zp/include/zp/str.d/utf16enc.ii index 6600cfb..d6ee238 100644 --- a/zp/include/zp/str.d/utf16enc.ii +++ b/zp/include/zp/str.d/utf16enc.ii @@ -4,7 +4,7 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -constexpr auto ::zp::utf16enc(::zp::c01 * dst,::zp::c02 const * src) noexcept -> void { +zp_prv_constexpr auto ::zp::utf16enc(::zp::c01 * dst,::zp::c02 const * src) zp_prv_nthrw -> void { for (;;++src) { auto const chr = *src; diff --git a/zp/include/zp/str.d/utf16enclen.ii b/zp/include/zp/str.d/utf16enclen.ii index ef0d341..41de802 100644 --- a/zp/include/zp/str.d/utf16enclen.ii +++ b/zp/include/zp/str.d/utf16enclen.ii @@ -4,7 +4,7 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -constexpr auto ::zp::utf16enclen(::zp::c02 const * str) noexcept -> ::zp::sz { +zp_prv_constexpr auto ::zp::utf16enclen(::zp::c02 const * str) zp_prv_nthrw -> ::zp::sz { ::zp::sz len = 0x0u; for (;;++str) { diff --git a/zp/include/zp/str.d/utf8dec.ii b/zp/include/zp/str.d/utf8dec.ii index e5c4208..28bc9f1 100644 --- a/zp/include/zp/str.d/utf8dec.ii +++ b/zp/include/zp/str.d/utf8dec.ii @@ -4,7 +4,7 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -constexpr auto ::zp::utf8dec(::zp::c02 * dst,::zp::c8 const * src) noexcept -> void { +zp_prv_constexpr auto ::zp::utf8dec(::zp::c02 * dst,::zp::c8 const * src) zp_prv_nthrw -> void { for (;;++dst) { auto const oct = *src++; diff --git a/zp/include/zp/str.d/utf8declen.ii b/zp/include/zp/str.d/utf8declen.ii index 3a1f3c4..9fcce1f 100644 --- a/zp/include/zp/str.d/utf8declen.ii +++ b/zp/include/zp/str.d/utf8declen.ii @@ -4,7 +4,7 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -constexpr auto ::zp::utf8declen(::zp::c8 const * str) noexcept -> ::zp::sz { +zp_prv_constexpr auto ::zp::utf8declen(::zp::c8 const * str) zp_prv_nthrw -> ::zp::sz { ::zp::sz len = 0x0u; for (;;++len) { diff --git a/zp/include/zp/str.d/utf8enc.ii b/zp/include/zp/str.d/utf8enc.ii index f9011d9..4c21d9a 100644 --- a/zp/include/zp/str.d/utf8enc.ii +++ b/zp/include/zp/str.d/utf8enc.ii @@ -4,7 +4,7 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -constexpr auto ::zp::utf8enc(::zp::c8 * dst,::zp::c02 const * src) noexcept -> void { +zp_prv_constexpr auto ::zp::utf8enc(::zp::c8 * dst,::zp::c02 const * src) zp_prv_nthrw -> void { for (;;++src) { auto const chr = *src; diff --git a/zp/include/zp/str.d/utf8enclen.ii b/zp/include/zp/str.d/utf8enclen.ii index cf5d21f..2d9f94c 100644 --- a/zp/include/zp/str.d/utf8enclen.ii +++ b/zp/include/zp/str.d/utf8enclen.ii @@ -4,7 +4,7 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -constexpr auto ::zp::utf8enclen(::zp::c02 const * str) noexcept -> ::zp::sz { +zp_prv_constexpr auto ::zp::utf8enclen(::zp::c02 const * str) zp_prv_nthrw -> ::zp::sz { ::zp::sz len = 0x0u; for (;;++str) { diff --git a/zp/include/zp/str.d/win1252dec.ii b/zp/include/zp/str.d/win1252dec.ii index faba1c2..754496b 100644 --- a/zp/include/zp/str.d/win1252dec.ii +++ b/zp/include/zp/str.d/win1252dec.ii @@ -4,7 +4,7 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -constexpr auto ::zp::win1252dec(::zp::c02 * dst,::zp::c8 const * src) noexcept -> void { +zp_prv_constexpr auto ::zp::win1252dec(::zp::c02 * dst,::zp::c8 const * src) zp_prv_nthrw -> void { for (;;++src,++dst) { ::zp::c8 const chr = *src; diff --git a/zp/include/zp/str.d/win1252enc.ii b/zp/include/zp/str.d/win1252enc.ii index d4d714e..58c3bde 100644 --- a/zp/include/zp/str.d/win1252enc.ii +++ b/zp/include/zp/str.d/win1252enc.ii @@ -4,7 +4,7 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -constexpr auto ::zp::win1252enc(::zp::c8 * dst,::zp::c02 const * src) noexcept -> void { +zp_prv_constexpr auto ::zp::win1252enc(::zp::c8 * dst,::zp::c02 const * src) zp_prv_nthrw -> void { for (;;++src,++dst) { ::zp::c02 const chr = *src; diff --git a/zp/include/zp/str.h b/zp/include/zp/str.h index 1f080d6..0d8126d 100644 --- a/zp/include/zp/str.h +++ b/zp/include/zp/str.h @@ -4,12 +4,12 @@ If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. */ -#ifndef zp_priv_hdr_str -#define zp_priv_hdr_str +#ifndef zp_prv_hdr_str +#define zp_prv_hdr_str #include <zp/bs.h> -zp_priv_cdecl +zp_prv_cdecl zp_nthrw zp_sz zp_strcpy(char * dst, char const * src); zp_nthrw zp_useres bool zp_strequ(char const * lstr,char const * rstr); @@ -60,6 +60,6 @@ zp_nthrw void zp_fmtul( zp_c02 * buf,long unsigned val,zp_i8m bs,bool rtl); zp_nthrw void zp_fmtull(zp_c02 * buf,long long unsigned val,zp_i8m bs,bool rtl); zp_nthrw void zp_fmtus( zp_c02 * buf,short unsigned val,zp_i8m bs,bool rtl); -zp_priv_cdeclend +zp_prv_cdeclend #endif diff --git a/zp/source/any/bs/trp.cc b/zp/source/any/bs/trp.cc index 9985588..4f1f91e 100644 --- a/zp/source/any/bs/trp.cc +++ b/zp/source/any/bs/trp.cc @@ -7,7 +7,7 @@ #include <zp/bs> extern "C" void zp_trp() { -#if zp_priv_hasbuiltin(__builtin_trap) +#if zp_prv_hasbuiltin(__builtin_trap) __builtin_trap(); #endif for (;;) {} |