diff options
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | API-BREAK.txt | 32 | ||||
-rw-r--r-- | CHANGELOG.txt | 15 | ||||
-rw-r--r-- | CMakeLists.txt | 26 | ||||
-rwxr-xr-x | getTarget.sh (renamed from getarch.sh) | 10 | ||||
-rwxr-xr-x | install.sh | 42 | ||||
-rw-r--r-- | zp/CMakeLists.txt | 148 | ||||
-rw-r--r-- | zp/GNUmakefile | 263 | ||||
-rw-r--r-- | zp/include/zp/bs.d/isconsteval.ii | 2 | ||||
-rw-r--r-- | zp/include/zp/bs.h | 4 | ||||
-rw-r--r-- | zp/include/zp/mem | 12 | ||||
-rw-r--r-- | zp/include/zp/mem.d/cpy.ii | 2 | ||||
-rw-r--r-- | zp/include/zp/mem.d/memcpy.ii | 2 | ||||
-rw-r--r-- | zp/include/zp/str | 18 | ||||
-rw-r--r-- | zp/source/any/bs/trp.c | 2 | ||||
-rw-r--r-- | zp/source/any/mth/dot.cc | 18 | ||||
-rw-r--r-- | zp/source/any/mth/vadd.cc | 18 | ||||
-rw-r--r-- | zp/source/any/mth/vsub.cc | 18 |
18 files changed, 317 insertions, 319 deletions
@@ -1,5 +1,3 @@ -*.a -*.o -*.so +/build /install /test diff --git a/API-BREAK.txt b/API-BREAK.txt new file mode 100644 index 0000000..1785310 --- /dev/null +++ b/API-BREAK.txt @@ -0,0 +1,32 @@ +This file lists potential and planned API- +breaks. These are meant to be released +simultaneously to minimise the number of +extraneous and unnecessary breaks. + +When enough planned breaks are present, the +features are implemented and the major version +is incremented along with the minor and patch +versions being reset. + +Interfaces that are not public (those in the +impl, priv... namespaces) do NOT cause API- +breaks, as their use outside of the library is +both deprecated and causes UB (by our +definition). + + + +* Rename arch-macros to arc and impl to imp: +We usually use three-letter abbreviations, +however, other lengths are not prohibited. +Nevertheless, our coding style favours the +closest to three letters. Arc is already an +abbreviation for arch, so it doesn't seem too +far-fetched. The same goes for imp, and nobody +is (really) going to think we are dealing with +small numina. + +* Relicense project: +I'll have to research this a bit, but I'm not +sure if the MPL2 is permissive enough for my +needs. diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 8409cc1..970c268 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,18 @@ +# 0.0.2 + +* Migrate to CMake; +* Fix useres using the nodiscard attribute in all C++ editions; +* Fix the nodiscard attribute being used; +* Fix nthrw not always being specified; +* Don't use designated initialisation in C++; +* Fix trp definition in any; +* Add new file for listing potential API-breaks (API-BREAK.txt); +* Disable system calls by default; +* Fix getarch script on IA-32; +* Rename getarch script to getTarget; +* Add installation script; +* Update gitignore; + # 0.0.1 * Fix unused parameter and invalid invocation in overload of srh; diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..3ddb60e --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.17) + +set(ZP_ENABLE_SYSTEM_CALLS False CACHE BOOL "Disable the syscl function (False|True).") +set(ZP_LIBRARY_TYPE "Static" CACHE STRING "Type of library file (Static|Shared).") +set(ZP_TARGET "Any" CACHE STRING "Target of the library (Any or Amd64|Arm|Arm64|Ia32).") + +if("${ZP_LIBRARY_TYPE}" STREQUAL "Static") + set(ZP_LIBRARY_TYPE_VALUE STATIC) +elseif("${ZP_LIBRARY_TYPE}" STREQUAL "Shared") +set(ZP_LIBRARY_TYPE_VALUE SHARED) +else() + message(FATAL_ERROR "Library type \"${ZP_LIBRARY_TYPE}\" is invalid") +endif() + +message(STATUS "Building ${ZP_LIBRARY_TYPE} library") +message(STATUS "Targeting ${ZP_TARGET}") + +project( + zp + + VERSION 0.0.2 + HOMEPAGE_URL "https://mandelbrot.dk/zp" + LANGUAGES C CXX ASM +) + +add_subdirectory(zp) diff --git a/getarch.sh b/getTarget.sh index 718a64f..3530ee1 100755 --- a/getarch.sh +++ b/getTarget.sh @@ -4,16 +4,16 @@ machine="$(uname -m)" if [ "${machine}" == "x64" ] || [ "${machine}" == "x86_64" ] then - printf "amd64" + printf "Amd64" elif [ "${machine}" == "arm" ] then - printf "arm" + printf "Arm" elif [ "${machine}" == "aarch64" ] || [ "${machine}" == "aarch64_be" ] || [ "${machine}" == "arm64" ] || [ "${machine}" == "armv8b" ] || [ "${machine}" == "armv8l" ] then - printf "arm64" + printf "Arm64" elif [ "${machine}" == "i386" ] || [ "${machine}" == "i686" ] || [ "${machine}" == "x86" ] then - printf "arm64" + printf "Ia32" else - printf "unknown" + printf "Any" fi diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..9446ceb --- /dev/null +++ b/install.sh @@ -0,0 +1,42 @@ +blddir="${1}" +hdrdir="${2}" +libdir="${3}" + +if [ -z "${blddir}" ] +then + echo "Build directory not set!" + exit 1 +fi + +if [ -z "${hdrdir}" ] +then + echo "Header directory not set!" + exit 1 +fi + +if [ -z "${libdir}" ] +then + echo "Library directory not set!" + exit 1 +fi + +rm -fr "${blddir}" +cmake -B"${blddir}" -DCMAKE_BUILD_TYPE="Release" -DZP_ENABLE_SYSTEM_CALLS="True" -DZP_LIBRARY_TYPE="Shared" -DZP_TARGET="$(./getTarget.sh)" +cmake --build build + +mkdir -pvm755 "${hdrdir}/zp/priv" +mkdir -pvm755 "${hdrdir}/zp/"{"bs","mem","str"}".d" +mkdir -pvm755 "${hdrdir}/zp/mth.d/"{"pair","vec2","vec3","vec4"} +mkdir -pvm755 "${libdir}" + +install -vm644 "zp/include/zp/"{"bs","mem","mth","str"}{"",".h"} "${hdrdir}/zp" +install -vm644 "zp/include/zp/priv/"{arch,chr,flt,impl,int,os,std}".h" "${hdrdir}/zp/priv" +install -vm644 "zp/include/zp/bs.d/"{"isconsteval","syscl","trp","urch"}".ii" "${hdrdir}/zp/bs.d" +install -vm644 "zp/include/zp/mem.d/"{"cpy","equ","fil","memcpy","memequ","memfil","memsrh","srh"}".ii" "${hdrdir}/zp/mem.d" +install -vm644 "zp/include/zp/mth.d/"{"abs","dist","divmod","dot","exp","isnan","vadd","vsub"}".ii" "${hdrdir}/zp/mth.d" +install -vm644 "zp/include/zp/mth.d/pair/cpair.ii" "${hdrdir}/zp/mth.d/pair" +install -vm644 "zp/include/zp/mth.d/vec2/cvec.ii" "${hdrdir}/zp/mth.d/vec2" +install -vm644 "zp/include/zp/mth.d/vec3/cvec.ii" "${hdrdir}/zp/mth.d/vec3" +install -vm644 "zp/include/zp/mth.d/vec4/cvec.ii" "${hdrdir}/zp/mth.d/vec4" +install -vm644 "zp/include/zp/str.d/"{"fmt","fmtlen","numdig","strcpy","strequ","strlen","strsrh","utf16dec","utf16declen","utf16enc","utf16enclen","utf8dec","utf8declen","utf8enc","utf8enclen","win1252dec","win1252enc"}".ii" "${hdrdir}/zp/str.d" +install -vm755 "${blddir}/zp/libzp.so" "${libdir}" diff --git a/zp/CMakeLists.txt b/zp/CMakeLists.txt new file mode 100644 index 0000000..bc6457e --- /dev/null +++ b/zp/CMakeLists.txt @@ -0,0 +1,148 @@ +cmake_minimum_required(VERSION 3.17) + +set(CMAKE_C_STANDARD 99) +set(CMAKE_CXX_STANDARD 14) + +set(ZP_OBJECT_BS_TRP "source/any/bs/trp.c") +set(ZP_OBJECT_BS_SYSCL "source/any/bs/syscl.c") + +set(ZP_OBJECT_MEM_MEMCPY "source/any/mem/memcpy.cc") +set(ZP_OBJECT_MEM_MEMEQU "source/any/mem/memequ.cc") +set(ZP_OBJECT_MEM_MEMFIL "source/any/mem/memfil.cc") +set(ZP_OBJECT_MEM_MEMSRH "source/any/mem/memsrh.cc") + +set(ZP_OBJECT_MTH_ABS "source/any/mth/abs.cc") +set(ZP_OBJECT_MTH_DIVMOD "source/any/mth/divmod.cc") +set(ZP_OBJECT_MTH_DOT "source/any/mth/dot.cc") +set(ZP_OBJECT_MTH_VADD "source/any/mth/vadd.cc") +set(ZP_OBJECT_MTH_VSUB "source/any/mth/vsub.cc") + +set(ZP_OBJECT_STR_FMT "source/any/str/fmt.cc") +set(ZP_OBJECT_STR_FMTLEN "source/any/str/fmtlen.cc") +set(ZP_OBJECT_STR_STRCPY "source/any/str/strcpy.cc") +set(ZP_OBJECT_STR_STREQU "source/any/str/strequ.cc") +set(ZP_OBJECT_STR_STRLEN "source/any/str/strlen.cc") +set(ZP_OBJECT_STR_STRSRH "source/any/str/strsrh.cc") +set(ZP_OBJECT_STR_UTF16DEC "source/any/str/utf16dec.cc") +set(ZP_OBJECT_STR_UTF16DECLEN "source/any/str/utf16declen.cc") +set(ZP_OBJECT_STR_UTF16ENC "source/any/str/utf16enc.cc") +set(ZP_OBJECT_STR_UTF16ENCLEN "source/any/str/utf16enclen.cc") +set(ZP_OBJECT_STR_UTF32CPY "source/any/str/utf32cpy.cc") +set(ZP_OBJECT_STR_UTF32EQU "source/any/str/utf32equ.cc") +set(ZP_OBJECT_STR_UTF32LEN "source/any/str/utf32len.cc") +set(ZP_OBJECT_STR_UTF32SRH "source/any/str/utf32srh.cc") +set(ZP_OBJECT_STR_UTF8DEC "source/any/str/utf8dec.cc") +set(ZP_OBJECT_STR_UTF8DECLEN "source/any/str/utf8declen.cc") +set(ZP_OBJECT_STR_UTF8ENC "source/any/str/utf8enc.cc") +set(ZP_OBJECT_STR_UTF8ENCLEN "source/any/str/utf8enclen.cc") +set(ZP_OBJECT_STR_WIN1252DEC "source/any/str/win1252dec.cc") +set(ZP_OBJECT_STR_WIN1252ENC "source/any/str/win1252enc.cc") +set(ZP_OBJECT_STR_WSTRCPY "source/any/str/wstrcpy.cc") +set(ZP_OBJECT_STR_WSTREQU "source/any/str/wstrequ.cc") +set(ZP_OBJECT_STR_WSTRLEN "source/any/str/wstrlen.cc") +set(ZP_OBJECT_STR_WSTRSRH "source/any/str/wstrsrh.cc") + +if("${ZP_TARGET_}" STREQUAL "Amd64") + set(ZP_OBJECT_BS_SYSCL "source/amd64/bs/syscl.s") + set(ZP_OBJECT_BS_TRP "source/amd64/bs/trp.s") + + set(ZP_OBJECT_MEM_MEMCPY "source/amd64/mem/memcpy.s") + set(ZP_OBJECT_MEM_MEMFIL "source/amd64/mem/memfil.s") +endif() + +if("${ZP_TARGET_}" STREQUAL "Arm") + set(ZP_OBJECT_BS_SYSCL "source/arm/bs/syscl.s") +endif() + +if("${ZP_TARGET_}" STREQUAL "Arm64") + set(ZP_OBJECT_BS_SYSCL "source/arm64/bs/syscl.s") +endif() + +if("${ZP_TARGET_}" STREQUAL "Ia32") + set(ZP_OBJECT_BS_SYSCL "source/ia32/bs/syscl.s") +endif() + +if(NOT ${ZP_ENABLE_SYSTEM_CALLS}) + set(ZP_OBJECT_BS_SYSCL "") +endif() + +add_library( + zp ${ZP_LIBRARY_TYPE_VALUE} + + "${ZP_OBJECT_BS_TRP}" + "${ZP_OBJECT_BS_SYSCL}" + + "${ZP_OBJECT_MEM_MEMCPY}" + "${ZP_OBJECT_MEM_MEMEQU}" + "${ZP_OBJECT_MEM_MEMFIL}" + "${ZP_OBJECT_MEM_MEMSRH}" + + "${ZP_OBJECT_MTH_ABS}" + "${ZP_OBJECT_MTH_DIVMOD}" + "${ZP_OBJECT_MTH_DOT}" + "${ZP_OBJECT_MTH_VADD}" + "${ZP_OBJECT_MTH_VSUB}" + + "${ZP_OBJECT_STR_FMT}" + "${ZP_OBJECT_STR_FMTLEN}" + "${ZP_OBJECT_STR_STRCPY}" + "${ZP_OBJECT_STR_STREQU}" + "${ZP_OBJECT_STR_STRLEN}" + "${ZP_OBJECT_STR_STRSRH}" + "${ZP_OBJECT_STR_UTF16DEC}" + "${ZP_OBJECT_STR_UTF16DECLEN}" + "${ZP_OBJECT_STR_UTF16ENC}" + "${ZP_OBJECT_STR_UTF16ENCLEN}" + "${ZP_OBJECT_STR_UTF32CPY}" + "${ZP_OBJECT_STR_UTF32EQU}" + "${ZP_OBJECT_STR_UTF32LEN}" + "${ZP_OBJECT_STR_UTF32SRH}" + "${ZP_OBJECT_STR_UTF8DEC}" + "${ZP_OBJECT_STR_UTF8DECLEN}" + "${ZP_OBJECT_STR_UTF8ENC}" + "${ZP_OBJECT_STR_UTF8ENCLEN}" + "${ZP_OBJECT_STR_WIN1252DEC}" + "${ZP_OBJECT_STR_WIN1252ENC}" + "${ZP_OBJECT_STR_WSTRCPY}" + "${ZP_OBJECT_STR_WSTREQU}" + "${ZP_OBJECT_STR_WSTRLEN}" + "${ZP_OBJECT_STR_WSTRSRH}" +) + +target_include_directories( + zp PUBLIC + + "include" +) + +target_compile_definitions( + zp PRIVATE + + zp_priv_nconsteval +) + +if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang|GNU") + target_compile_options( + zp PRIVATE + + $<IF:$<STREQUAL:"${CMAKE_BUILD_TYPE}","Debug">,-Og,-Oz> + -Wall + -Wextra + -Wmissing-prototypes + -Wpedantic + -fdiagnostics-color=always + -ffreestanding + -fno-exceptions + -fshort-enums + $<IF:$<STREQUAL:"${ZP_LIBRARY_TYPE}","Shared">,-g,> + -nostdlib + ) +elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + target_compile_options( + zp PRIVATE + + /O2 + /W4 + $<IF:$<STREQUAL:"${ZP_LIBRARY_TYPE}","Shared">,$<IF:$<STREQUAL:"${CMAKE_BUILD_TYPE}","Debug">,/Zo>> + ) +endif() diff --git a/zp/GNUmakefile b/zp/GNUmakefile deleted file mode 100644 index c5e6b44..0000000 --- a/zp/GNUmakefile +++ /dev/null @@ -1,263 +0,0 @@ -# Copyright 2022-2023 Gabriel Jensen. -# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. -# If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>. - -ifeq "$(arch)" "" -arch := $(shell ../getarch.sh) -ifeq "$(arch)" "unknown" -$(error Unable to detect architecture!) -endif -$(info Detected architecture $(arch)!) -endif - -ifeq "$(stdc)" "" -stdc := c99 -endif - -ifeq "$(stdcxx)" "" -stdcxx := c++14 -endif - -OBJ_BS_TRP := source/any/bs/trp.o - -OBJ_MEM_MEMCPY := source/any/mem/memcpy.o -OBJ_MEM_MEMEQU := source/any/mem/memequ.o -OBJ_MEM_MEMFIL := source/any/mem/memfil.o -OBJ_MEM_MEMSRH := source/any/mem/memsrh.o - -OBJ_MTH_ABS := source/any/mth/abs.o -OBJ_MTH_DIVMOD := source/any/mth/divmod.o -OBJ_MTH_DOT := source/any/mth/dot.o -OBJ_MTH_VADD := source/any/mth/vadd.o -OBJ_MTH_VSUB := source/any/mth/vsub.o - -OBJ_STR_FMT := source/any/str/fmt.o -OBJ_STR_FMTLEN := source/any/str/fmtlen.o -OBJ_STR_STRCPY := source/any/str/strcpy.o -OBJ_STR_STREQU := source/any/str/strequ.o -OBJ_STR_STRLEN := source/any/str/strlen.o -OBJ_STR_STRSRH := source/any/str/strsrh.o -OBJ_STR_UTF16DEC := source/any/str/utf16dec.o -OBJ_STR_UTF16DECLEN := source/any/str/utf16declen.o -OBJ_STR_UTF16ENC := source/any/str/utf16enc.o -OBJ_STR_UTF16ENCLEN := source/any/str/utf16enclen.o -OBJ_STR_UTF32CPY := source/any/str/utf32cpy.o -OBJ_STR_UTF32EQU := source/any/str/utf32equ.o -OBJ_STR_UTF32LEN := source/any/str/utf32len.o -OBJ_STR_UTF32SRH := source/any/str/utf32srh.o -OBJ_STR_UTF8DEC := source/any/str/utf8dec.o -OBJ_STR_UTF8DECLEN := source/any/str/utf8declen.o -OBJ_STR_UTF8ENC := source/any/str/utf8enc.o -OBJ_STR_UTF8ENCLEN := source/any/str/utf8enclen.o -OBJ_STR_WIN1252DEC := source/any/str/win1252dec.o -OBJ_STR_WIN1252ENC := source/any/str/win1252enc.o -OBJ_STR_WSTRCPY := source/any/str/wstrcpy.o -OBJ_STR_WSTREQU := source/any/str/wstrequ.o -OBJ_STR_WSTRLEN := source/any/str/wstrlen.o -OBJ_STR_WSTRSRH := source/any/str/wstrsrh.o - -OBJ_BS_SYSCL := source/any/bs/syscl.o - -ifeq "$(arch)" "amd64" - -OBJ_BS_SYSCL := source/amd64/bs/syscl.o -OBJ_BS_TRP := source/amd64/bs/trp.o - -OBJ_MEM_MEMCPY := source/amd64/mem/memcpy.o -OBJ_MEM_MEMFIL := source/amd64/mem/memfil.o - -else ifeq "$(arch)" "arm" - -OBJ_BS_SYSCL := source/arm/bs/syscl.o - -else ifeq "$(arch)" "arm64" - -OBJ_BS_SYSCL := source/arm64/bs/syscl.o - -else ifeq "$(arch)" "ia32" - -OBJ_BS_SYSCL := source/ia32/bs/syscl.o - -endif - -OBJS := \ - $(OBJ_BS_TRP) \ - \ - $(OBJ_MEM_MEMCPY) \ - $(OBJ_MEM_MEMEQU) \ - $(OBJ_MEM_MEMFIL) \ - $(OBJ_MEM_MEMSRH) \ - \ - $(OBJ_MTH_ABS) \ - $(OBJ_MTH_DIVMOD) \ - $(OBJ_MTH_DOT) \ - $(OBJ_MTH_VADD) \ - $(OBJ_MTH_VSUB) \ - \ - $(OBJ_STR_FMT) \ - $(OBJ_STR_FMTLEN) \ - $(OBJ_STR_STRCPY) \ - $(OBJ_STR_STREQU) \ - $(OBJ_STR_STRLEN) \ - $(OBJ_STR_STRSRH) \ - $(OBJ_STR_UTF16DEC) \ - $(OBJ_STR_UTF16DECLEN) \ - $(OBJ_STR_UTF16ENC) \ - $(OBJ_STR_UTF16ENCLEN) \ - $(OBJ_STR_UTF32CPY) \ - $(OBJ_STR_UTF32EQU) \ - $(OBJ_STR_UTF32LEN) \ - $(OBJ_STR_UTF32SRH) \ - $(OBJ_STR_UTF8DEC) \ - $(OBJ_STR_UTF8DECLEN) \ - $(OBJ_STR_UTF8ENC) \ - $(OBJ_STR_UTF8ENCLEN) \ - $(OBJ_STR_WIN1252DEC) \ - $(OBJ_STR_WIN1252ENC) \ - $(OBJ_STR_WSTRCPY) \ - $(OBJ_STR_WSTREQU) \ - $(OBJ_STR_WSTRLEN) \ - $(OBJ_STR_WSTRSRH) - -ifneq "$(nosyscl)" "true" -OBJS := \ - $(OBJS) \ - $(OBJ_BS_SYSCL) -endif - -ifeq "$(shrlib)" "true" -LIB := libzp.so -else -LIB := libzp.a -endif - -HDRS := \ - include/zp/bs \ - include/zp/bs.h \ - include/zp/mem \ - include/zp/mem.h \ - include/zp/mth \ - include/zp/mth.h \ - include/zp/str \ - include/zp/str.h \ - include/zp/bs.d/isconsteval.ii \ - include/zp/bs.d/syscl.ii \ - include/zp/bs.d/trp.ii \ - include/zp/bs.d/urch.ii \ - include/zp/mem.d/cpy.ii \ - include/zp/mem.d/equ.ii \ - include/zp/mem.d/fil.ii \ - include/zp/mem.d/memcpy.ii \ - include/zp/mem.d/memequ.ii \ - include/zp/mem.d/memfil.ii \ - include/zp/mem.d/memsrh.ii \ - include/zp/mem.d/srh.ii \ - include/zp/mth.d/abs.ii \ - include/zp/mth.d/dist.ii \ - include/zp/mth.d/divmod.ii \ - include/zp/mth.d/dot.ii \ - include/zp/mth.d/exp.ii \ - include/zp/mth.d/isnan.ii \ - include/zp/mth.d/vadd.ii \ - include/zp/mth.d/vsub.ii \ - include/zp/mth.d/pair/cpair.ii \ - include/zp/mth.d/vec2/cvec.ii \ - include/zp/mth.d/vec3/cvec.ii \ - include/zp/mth.d/vec4/cvec.ii \ - include/zp/priv/arch.h \ - include/zp/priv/chr.h \ - include/zp/priv/flt.h \ - include/zp/priv/impl.h \ - include/zp/priv/int.h \ - include/zp/priv/os.h \ - include/zp/priv/std.h \ - include/zp/str.d/fmt.ii \ - include/zp/str.d/fmtlen.ii \ - include/zp/str.d/numdig.ii \ - include/zp/str.d/strcpy.ii \ - include/zp/str.d/strequ.ii \ - include/zp/str.d/strlen.ii \ - include/zp/str.d/strsrh.ii \ - include/zp/str.d/utf16dec.ii \ - include/zp/str.d/utf16declen.ii \ - include/zp/str.d/utf16enc.ii \ - include/zp/str.d/utf16enclen.ii \ - include/zp/str.d/utf8dec.ii \ - include/zp/str.d/utf8declen.ii \ - include/zp/str.d/utf8enc.ii \ - include/zp/str.d/utf8enclen.ii \ - include/zp/str.d/win1252dec.ii \ - include/zp/str.d/win1252enc.ii \ - -CFLAGS := \ - -Iinclude \ - -Oz \ - -Wall \ - -Wextra \ - -ffreestanding \ - -fshort-enums \ - -nostdlib \ - -pipe \ - -std=$(stdc) - -CXXFLAGS := \ - -Dzp_priv_consteval \ - -Iinclude \ - -Oz \ - -Wall \ - -Wextra \ - -ffreestanding \ - -fno-exceptions \ - -fshort-enums \ - -nostdlib \ - -pipe \ - -std=$(stdcxx) - -ifeq "$(shrlib)" "true" -CFLAGS := \ - $(CFLAGS) \ - -g - -CXXFLAGS := \ - $(CXXFLAGS) \ - -g - -LDFLAGS := \ - $(LDFLAGS) \ - -shared -endif - -.PHONY: clean install purge - -ifeq "$(shrlib)" "true" -$(LIB): $(OBJS) - $(CC) $(LDFLAGS) -o$(@) $(^) -else -$(LIB): $(OBJS) - $(AR) r $(@) $(^) -endif - -$(OBJS): $(HDRS) - -install: $(LIB) - mkdir -pm755 "$(HDRDIR)/zp/priv" - mkdir -pm755 "$(HDRDIR)/zp/"{"bs","mem","str"}".d" - mkdir -pm755 "$(HDRDIR)/zp/mth.d/"{"pair","vec2","vec3","vec4"} - mkdir -pm755 "$(LIBDIR)" - install -m644 "include/zp/"{"bs","mem","mth","str"}{"",".h"} "$(HDRDIR)/zp" - install -m644 "include/zp/priv/"{arch,chr,flt,impl,int,os,std}".h" "$(HDRDIR)/zp/priv" - install -m644 "include/zp/bs.d/"{"isconsteval","syscl","trp","urch"}".ii" "$(HDRDIR)/zp/bs.d" - install -m644 "include/zp/mem.d/"{"cpy","equ","fil","memcpy","memequ","memfil","memsrh","srh"}".ii" "$(HDRDIR)/zp/mem.d" - install -m644 "include/zp/mth.d/"{"abs","dist","divmod","dot","exp","isnan","vadd","vsub"}".ii" "$(HDRDIR)/zp/mth.d" - install -m644 "include/zp/mth.d/pair/cpair.ii" "$(HDRDIR)/zp/mth.d/pair" - install -m644 "include/zp/mth.d/vec2/cvec.ii" "$(HDRDIR)/zp/mth.d/vec2" - install -m644 "include/zp/mth.d/vec3/cvec.ii" "$(HDRDIR)/zp/mth.d/vec3" - install -m644 "include/zp/mth.d/vec4/cvec.ii" "$(HDRDIR)/zp/mth.d/vec4" - install -m644 "include/zp/str.d/"{"fmt","fmtlen","numdig","strcpy","strequ","strlen","strsrh","utf16dec","utf16declen","utf16enc","utf16enclen","utf8dec","utf8declen","utf8enc","utf8enclen","win1252dec","win1252enc"}".ii" "$(HDRDIR)/zp/str.d" - install -m755 "$(LIB)" "$(LIBDIR)" - -clean: - $(RM) $(OBJS) - -purge: clean - $(RM) $(LIB) diff --git a/zp/include/zp/bs.d/isconsteval.ii b/zp/include/zp/bs.d/isconsteval.ii index c51fbee..ec974b7 100644 --- a/zp/include/zp/bs.d/isconsteval.ii +++ b/zp/include/zp/bs.d/isconsteval.ii @@ -5,7 +5,7 @@ */ constexpr auto ::zp::isconsteval() noexcept -> bool { -#ifdef zp_priv_consteval // We use this to implement the run-time API for the "any" architecture. +#ifdef zp_priv_nconsteval // We use this to implement the run-time API for the "any" architecture. return true; #elif zp_priv_hasbuiltin(__builtin_is_constant_evaluated) return __builtin_is_constant_evaluated(); diff --git a/zp/include/zp/bs.h b/zp/include/zp/bs.h index 8ecff15..5757c8a 100644 --- a/zp/include/zp/bs.h +++ b/zp/include/zp/bs.h @@ -220,9 +220,9 @@ #define zp_urch() (zp_trp()) #endif -#if zp_priv_hasattr(__unused__) +#if zp_priv_hasattr(__warn_unused_result__) #define zp_useres __attribute__ ((warn_unused_result)) -#elif zp_std_c23 || zp_std_cxx +#elif zp_std_c23 || zp_std_cxx17 #define zp_useres [[nodiscard]] #else #define zp_useres diff --git a/zp/include/zp/mem b/zp/include/zp/mem index 0354be0..8404cc0 100644 --- a/zp/include/zp/mem +++ b/zp/include/zp/mem @@ -18,21 +18,21 @@ namespace zp { 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::cpyret<dsttyp,srctyp>; - template<typename ltyp,typename rtyp> [[nodiscard]] 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) noexcept -> bool; template<typename typ> zp_iln inline auto memfil(typ * dst,char unsigned val,::zp::sz const num) noexcept -> void; - template<typename typ> [[nodiscard]] zp_iln inline auto memsrh(typ * buf,char unsigned val,::zp::sz const num) noexcept -> typ *; - template<typename typ> [[nodiscard]] 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) 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> constexpr auto cpy(typ * zp_restr dst,typ const * zp_restr src,::zp::sz const num) noexcept -> ::zp::cpyret<typ,typ>; - template<typename typ> [[nodiscard]] constexpr auto equ(typ const * lbuf,typ const * rbuf,::zp::sz const num) noexcept -> bool; + template<typename typ> zp_useres constexpr auto equ(typ const * lbuf,typ const * rbuf,::zp::sz const num) noexcept -> bool; template<typename typ> constexpr auto fil(typ * dst,typ const val,::zp::sz const num) noexcept -> void; - template<typename typ> [[nodiscard]] constexpr auto srh(typ * buf,typ const val,::zp::sz const num) noexcept -> typ *; - template<typename typ> [[nodiscard]] constexpr auto srh(typ const * buf,typ const val,::zp::sz const num) noexcept -> typ const *; + 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 *; } #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 002b0d0..74f9610 100644 --- a/zp/include/zp/mem.d/cpy.ii +++ b/zp/include/zp/mem.d/cpy.ii @@ -10,5 +10,5 @@ template<typename typ> constexpr auto ::zp::cpy(typ * zp_restr dst,typ const * z typ * const zp_restr stop = dst+num; while (dst != stop) {*dst++ = *src++;} - return ::zp::cpyret<typ,typ> {.dst = dst,.src = const_cast<typ *>(src),}; + return ::zp::cpyret<typ,typ> {dst,const_cast<typ *>(src),}; } diff --git a/zp/include/zp/mem.d/memcpy.ii b/zp/include/zp/mem.d/memcpy.ii index 6ce95b3..fe7b621 100644 --- a/zp/include/zp/mem.d/memcpy.ii +++ b/zp/include/zp/mem.d/memcpy.ii @@ -7,5 +7,5 @@ template<typename dsttyp,typename srctyp> inline auto ::zp::memcpy(dsttyp * zp_restr dst,srctyp const * zp_restr src,::zp::sz const num) noexcept -> ::zp::cpyret<dsttyp,srctyp> { ::zp_cpyret const cpyret = ::zp_memcpy(dst,src,num); - return ::zp::cpyret<dsttyp,srctyp> {.dst = static_cast<dsttyp *>(cpyret.dst),.src = static_cast<srctyp *>(cpyret.src),}; + return ::zp::cpyret<dsttyp,srctyp> {static_cast<dsttyp *>(cpyret.dst),static_cast<srctyp *>(cpyret.src),}; } diff --git a/zp/include/zp/str b/zp/include/zp/str index b811558..d601928 100644 --- a/zp/include/zp/str +++ b/zp/include/zp/str @@ -12,19 +12,19 @@ namespace zp { namespace priv { - template<typename typ> [[nodiscard]] constexpr auto numdig(typ val,::zp::i8m bs) noexcept -> ::zp::sz; + template<typename typ> zp_useres constexpr auto numdig(typ val,::zp::i8m bs) noexcept -> ::zp::sz; } template<typename typ> constexpr auto strcpy(typ * dst, typ const * src) noexcept -> ::zp::sz; - template<typename typ> [[nodiscard]] constexpr auto strequ(typ const * lstr,typ const * rstr) noexcept -> bool; + 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> [[nodiscard]] constexpr auto strsrh(typ * str, typ chr) noexcept -> typ *; - template<typename typ> [[nodiscard]] constexpr auto strsrh(typ const * str, typ chr) noexcept -> typ const *; + 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 *; - [[nodiscard]] constexpr auto utf8enclen( ::zp::c02 const * str) noexcept -> ::zp::sz; - [[nodiscard]] constexpr auto utf8declen( ::zp::c8 const * str) noexcept -> ::zp::sz; - [[nodiscard]] constexpr auto utf16enclen(::zp::c02 const * str) noexcept -> ::zp::sz; - [[nodiscard]] constexpr auto utf16declen(::zp::c01 const * str) noexcept -> ::zp::sz; + 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; constexpr auto utf8enc( ::zp::c8 * dst,::zp::c02 const * src) noexcept -> void; constexpr auto utf8dec( ::zp::c02 * dst,::zp::c8 const * src) noexcept -> void; @@ -33,7 +33,7 @@ namespace zp { constexpr auto win1252enc(::zp::c8 * dst,::zp::c02 const * src) noexcept -> void; constexpr auto win1252dec(::zp::c02 * dst,::zp::c8 const * src) noexcept -> void; - template<typename typ> [[nodiscard]] constexpr auto fmtlen(typ val,::zp::i8m bs) noexcept -> ::zp::sz; // Including (potential) decorations. + template<typename typ> zp_useres constexpr auto fmtlen(typ val,::zp::i8m bs) noexcept -> ::zp::sz; // Including (potential) decorations. template<typename typ> constexpr auto fmt(::zp::c02 * buf,typ val,::zp::i8m bs,bool rtl = false) noexcept -> void; } diff --git a/zp/source/any/bs/trp.c b/zp/source/any/bs/trp.c index 4082ffc..3b9bbc7 100644 --- a/zp/source/any/bs/trp.c +++ b/zp/source/any/bs/trp.c @@ -6,7 +6,7 @@ #include <zp/bs.h> -void zp_trp() { +void zp_trp(void) { #if zp_priv_hasbuiltin(__builtin_trap) __builtin_trap(); #endif diff --git a/zp/source/any/mth/dot.cc b/zp/source/any/mth/dot.cc index cc5bd56..6140bce 100644 --- a/zp/source/any/mth/dot.cc +++ b/zp/source/any/mth/dot.cc @@ -7,15 +7,15 @@ #include <zp/mth> extern "C" { - auto zp_dot2f( ::zp_vec2f const lvec,::zp_vec2f const rvec) -> float {return ::zp::dot(::zp::vec2<float> {lvec.x,lvec.y,},::zp::vec2<float> {rvec.x,rvec.y,});} - auto zp_dot2d( ::zp_vec2d const lvec,::zp_vec2d const rvec) -> double {return ::zp::dot(::zp::vec2<double> {lvec.x,lvec.y,},::zp::vec2<double> {rvec.x,rvec.y,});} - auto zp_dot2ld(::zp_vec2ld const lvec,::zp_vec2ld const rvec) -> long double {return ::zp::dot(::zp::vec2<long double> {lvec.x,lvec.y,},::zp::vec2<long double> {rvec.x,rvec.y,});} + zp_nthrw auto zp_dot2f( ::zp_vec2f const lvec,::zp_vec2f const rvec) -> float {return ::zp::dot(::zp::vec2<float> {lvec.x,lvec.y,},::zp::vec2<float> {rvec.x,rvec.y,});} + zp_nthrw auto zp_dot2d( ::zp_vec2d const lvec,::zp_vec2d const rvec) -> double {return ::zp::dot(::zp::vec2<double> {lvec.x,lvec.y,},::zp::vec2<double> {rvec.x,rvec.y,});} + zp_nthrw auto zp_dot2ld(::zp_vec2ld const lvec,::zp_vec2ld const rvec) -> long double {return ::zp::dot(::zp::vec2<long double> {lvec.x,lvec.y,},::zp::vec2<long double> {rvec.x,rvec.y,});} - auto zp_dot3f( ::zp_vec3f const lvec,::zp_vec3f const rvec) -> float {return ::zp::dot(::zp::vec3<float> {lvec.x,lvec.y,lvec.z,},::zp::vec3<float> {rvec.x,rvec.y,rvec.z,});} - auto zp_dot3d( ::zp_vec3d const lvec,::zp_vec3d const rvec) -> double {return ::zp::dot(::zp::vec3<double> {lvec.x,lvec.y,lvec.z,},::zp::vec3<double> {rvec.x,rvec.y,rvec.z,});} - auto zp_dot3ld(::zp_vec3ld const lvec,::zp_vec3ld const rvec) -> long double {return ::zp::dot(::zp::vec3<long double> {lvec.x,lvec.y,lvec.z,},::zp::vec3<long double> {rvec.x,rvec.y,rvec.z,});} + zp_nthrw auto zp_dot3f( ::zp_vec3f const lvec,::zp_vec3f const rvec) -> float {return ::zp::dot(::zp::vec3<float> {lvec.x,lvec.y,lvec.z,},::zp::vec3<float> {rvec.x,rvec.y,rvec.z,});} + zp_nthrw auto zp_dot3d( ::zp_vec3d const lvec,::zp_vec3d const rvec) -> double {return ::zp::dot(::zp::vec3<double> {lvec.x,lvec.y,lvec.z,},::zp::vec3<double> {rvec.x,rvec.y,rvec.z,});} + zp_nthrw auto zp_dot3ld(::zp_vec3ld const lvec,::zp_vec3ld const rvec) -> long double {return ::zp::dot(::zp::vec3<long double> {lvec.x,lvec.y,lvec.z,},::zp::vec3<long double> {rvec.x,rvec.y,rvec.z,});} - auto zp_dot4f( ::zp_vec4f const lvec,::zp_vec4f const rvec) -> float {return ::zp::dot(::zp::vec4<float> {lvec.x,lvec.y,lvec.z,lvec.w,},::zp::vec4<float> {rvec.x,rvec.y,rvec.z,rvec.w,});} - auto zp_dot4d( ::zp_vec4d const lvec,::zp_vec4d const rvec) -> double {return ::zp::dot(::zp::vec4<double> {lvec.x,lvec.y,lvec.z,lvec.w,},::zp::vec4<double> {rvec.x,rvec.y,rvec.z,rvec.w,});} - auto zp_dot4ld(::zp_vec4ld const lvec,::zp_vec4ld const rvec) -> long double {return ::zp::dot(::zp::vec4<long double> {lvec.x,lvec.y,lvec.z,lvec.w,},::zp::vec4<long double> {rvec.x,rvec.y,rvec.z,rvec.w,});} + zp_nthrw auto zp_dot4f( ::zp_vec4f const lvec,::zp_vec4f const rvec) -> float {return ::zp::dot(::zp::vec4<float> {lvec.x,lvec.y,lvec.z,lvec.w,},::zp::vec4<float> {rvec.x,rvec.y,rvec.z,rvec.w,});} + zp_nthrw auto zp_dot4d( ::zp_vec4d const lvec,::zp_vec4d const rvec) -> double {return ::zp::dot(::zp::vec4<double> {lvec.x,lvec.y,lvec.z,lvec.w,},::zp::vec4<double> {rvec.x,rvec.y,rvec.z,rvec.w,});} + zp_nthrw auto zp_dot4ld(::zp_vec4ld const lvec,::zp_vec4ld const rvec) -> long double {return ::zp::dot(::zp::vec4<long double> {lvec.x,lvec.y,lvec.z,lvec.w,},::zp::vec4<long double> {rvec.x,rvec.y,rvec.z,rvec.w,});} } diff --git a/zp/source/any/mth/vadd.cc b/zp/source/any/mth/vadd.cc index 3513ea5..5f357c3 100644 --- a/zp/source/any/mth/vadd.cc +++ b/zp/source/any/mth/vadd.cc @@ -7,15 +7,15 @@ #include <zp/mth> extern "C" { - auto zp_v2addf( ::zp_vec2f const lvec,::zp_vec2f const rvec) -> ::zp_vec2f {return ::zp::vadd(::zp::vec2<float> {lvec.x,lvec.y,},::zp::vec2<float> {rvec.x,rvec.y,}).cvec();} - auto zp_v2addd( ::zp_vec2d const lvec,::zp_vec2d const rvec) -> ::zp_vec2d {return ::zp::vadd(::zp::vec2<double> {lvec.x,lvec.y,},::zp::vec2<double> {rvec.x,rvec.y,}).cvec();} - auto zp_v2addld(::zp_vec2ld const lvec,::zp_vec2ld const rvec) -> ::zp_vec2ld {return ::zp::vadd(::zp::vec2<long double> {lvec.x,lvec.y,},::zp::vec2<long double> {rvec.x,rvec.y,}).cvec();} + zp_nthrw auto zp_v2addf( ::zp_vec2f const lvec,::zp_vec2f const rvec) -> ::zp_vec2f {return ::zp::vadd(::zp::vec2<float> {lvec.x,lvec.y,},::zp::vec2<float> {rvec.x,rvec.y,}).cvec();} + zp_nthrw auto zp_v2addd( ::zp_vec2d const lvec,::zp_vec2d const rvec) -> ::zp_vec2d {return ::zp::vadd(::zp::vec2<double> {lvec.x,lvec.y,},::zp::vec2<double> {rvec.x,rvec.y,}).cvec();} + zp_nthrw auto zp_v2addld(::zp_vec2ld const lvec,::zp_vec2ld const rvec) -> ::zp_vec2ld {return ::zp::vadd(::zp::vec2<long double> {lvec.x,lvec.y,},::zp::vec2<long double> {rvec.x,rvec.y,}).cvec();} - auto zp_v3addf( ::zp_vec3f const lvec,::zp_vec3f const rvec) -> ::zp_vec3f {return ::zp::vadd(::zp::vec3<float> {lvec.x,lvec.y,lvec.z,},::zp::vec3<float> {rvec.x,rvec.y,rvec.z,}).cvec();} - auto zp_v3addd( ::zp_vec3d const lvec,::zp_vec3d const rvec) -> ::zp_vec3d {return ::zp::vadd(::zp::vec3<double> {lvec.x,lvec.y,lvec.z,},::zp::vec3<double> {rvec.x,rvec.y,rvec.z,}).cvec();} - auto zp_v3addld(::zp_vec3ld const lvec,::zp_vec3ld const rvec) -> ::zp_vec3ld {return ::zp::vadd(::zp::vec3<long double> {lvec.x,lvec.y,lvec.z,},::zp::vec3<long double> {rvec.x,rvec.y,rvec.z,}).cvec();} + zp_nthrw auto zp_v3addf( ::zp_vec3f const lvec,::zp_vec3f const rvec) -> ::zp_vec3f {return ::zp::vadd(::zp::vec3<float> {lvec.x,lvec.y,lvec.z,},::zp::vec3<float> {rvec.x,rvec.y,rvec.z,}).cvec();} + zp_nthrw auto zp_v3addd( ::zp_vec3d const lvec,::zp_vec3d const rvec) -> ::zp_vec3d {return ::zp::vadd(::zp::vec3<double> {lvec.x,lvec.y,lvec.z,},::zp::vec3<double> {rvec.x,rvec.y,rvec.z,}).cvec();} + zp_nthrw auto zp_v3addld(::zp_vec3ld const lvec,::zp_vec3ld const rvec) -> ::zp_vec3ld {return ::zp::vadd(::zp::vec3<long double> {lvec.x,lvec.y,lvec.z,},::zp::vec3<long double> {rvec.x,rvec.y,rvec.z,}).cvec();} - auto zp_v4addf( ::zp_vec4f const lvec,::zp_vec4f const rvec) -> ::zp_vec4f {return ::zp::vadd(::zp::vec4<float> {lvec.x,lvec.y,lvec.z,lvec.w,},::zp::vec4<float> {rvec.x,rvec.y,rvec.z,rvec.w,}).cvec();} - auto zp_v4addd( ::zp_vec4d const lvec,::zp_vec4d const rvec) -> ::zp_vec4d {return ::zp::vadd(::zp::vec4<double> {lvec.x,lvec.y,lvec.z,lvec.w,},::zp::vec4<double> {rvec.x,rvec.y,rvec.z,rvec.w,}).cvec();} - auto zp_v4addld(::zp_vec4ld const lvec,::zp_vec4ld const rvec) -> ::zp_vec4ld {return ::zp::vadd(::zp::vec4<long double> {lvec.x,lvec.y,lvec.z,lvec.w,},::zp::vec4<long double> {rvec.x,rvec.y,rvec.z,rvec.w,}).cvec();} + zp_nthrw auto zp_v4addf( ::zp_vec4f const lvec,::zp_vec4f const rvec) -> ::zp_vec4f {return ::zp::vadd(::zp::vec4<float> {lvec.x,lvec.y,lvec.z,lvec.w,},::zp::vec4<float> {rvec.x,rvec.y,rvec.z,rvec.w,}).cvec();} + zp_nthrw auto zp_v4addd( ::zp_vec4d const lvec,::zp_vec4d const rvec) -> ::zp_vec4d {return ::zp::vadd(::zp::vec4<double> {lvec.x,lvec.y,lvec.z,lvec.w,},::zp::vec4<double> {rvec.x,rvec.y,rvec.z,rvec.w,}).cvec();} + zp_nthrw auto zp_v4addld(::zp_vec4ld const lvec,::zp_vec4ld const rvec) -> ::zp_vec4ld {return ::zp::vadd(::zp::vec4<long double> {lvec.x,lvec.y,lvec.z,lvec.w,},::zp::vec4<long double> {rvec.x,rvec.y,rvec.z,rvec.w,}).cvec();} } diff --git a/zp/source/any/mth/vsub.cc b/zp/source/any/mth/vsub.cc index 58977a4..7cea9c0 100644 --- a/zp/source/any/mth/vsub.cc +++ b/zp/source/any/mth/vsub.cc @@ -7,15 +7,15 @@ #include <zp/mth> extern "C" { - auto zp_v2subf( ::zp_vec2f const lvec,::zp_vec2f const rvec) -> ::zp_vec2f {return ::zp::vsub(::zp::vec2<float> {lvec.x,lvec.y,},::zp::vec2<float> {rvec.x,rvec.y,}).cvec();} - auto zp_v2subd( ::zp_vec2d const lvec,::zp_vec2d const rvec) -> ::zp_vec2d {return ::zp::vsub(::zp::vec2<double> {lvec.x,lvec.y,},::zp::vec2<double> {rvec.x,rvec.y,}).cvec();} - auto zp_v2subld(::zp_vec2ld const lvec,::zp_vec2ld const rvec) -> ::zp_vec2ld {return ::zp::vsub(::zp::vec2<long double> {lvec.x,lvec.y,},::zp::vec2<long double> {rvec.x,rvec.y,}).cvec();} + zp_nthrw auto zp_v2subf( ::zp_vec2f const lvec,::zp_vec2f const rvec) -> ::zp_vec2f {return ::zp::vsub(::zp::vec2<float> {lvec.x,lvec.y,},::zp::vec2<float> {rvec.x,rvec.y,}).cvec();} + zp_nthrw auto zp_v2subd( ::zp_vec2d const lvec,::zp_vec2d const rvec) -> ::zp_vec2d {return ::zp::vsub(::zp::vec2<double> {lvec.x,lvec.y,},::zp::vec2<double> {rvec.x,rvec.y,}).cvec();} + zp_nthrw auto zp_v2subld(::zp_vec2ld const lvec,::zp_vec2ld const rvec) -> ::zp_vec2ld {return ::zp::vsub(::zp::vec2<long double> {lvec.x,lvec.y,},::zp::vec2<long double> {rvec.x,rvec.y,}).cvec();} - auto zp_v3subf( ::zp_vec3f const lvec,::zp_vec3f const rvec) -> ::zp_vec3f {return ::zp::vsub(::zp::vec3<float> {lvec.x,lvec.y,lvec.z,},::zp::vec3<float> {rvec.x,rvec.y,rvec.z,}).cvec();} - auto zp_v3subd( ::zp_vec3d const lvec,::zp_vec3d const rvec) -> ::zp_vec3d {return ::zp::vsub(::zp::vec3<double> {lvec.x,lvec.y,lvec.z,},::zp::vec3<double> {rvec.x,rvec.y,rvec.z,}).cvec();} - auto zp_v3subld(::zp_vec3ld const lvec,::zp_vec3ld const rvec) -> ::zp_vec3ld {return ::zp::vsub(::zp::vec3<long double> {lvec.x,lvec.y,lvec.z,},::zp::vec3<long double> {rvec.x,rvec.y,rvec.z,}).cvec();} + zp_nthrw auto zp_v3subf( ::zp_vec3f const lvec,::zp_vec3f const rvec) -> ::zp_vec3f {return ::zp::vsub(::zp::vec3<float> {lvec.x,lvec.y,lvec.z,},::zp::vec3<float> {rvec.x,rvec.y,rvec.z,}).cvec();} + zp_nthrw auto zp_v3subd( ::zp_vec3d const lvec,::zp_vec3d const rvec) -> ::zp_vec3d {return ::zp::vsub(::zp::vec3<double> {lvec.x,lvec.y,lvec.z,},::zp::vec3<double> {rvec.x,rvec.y,rvec.z,}).cvec();} + zp_nthrw auto zp_v3subld(::zp_vec3ld const lvec,::zp_vec3ld const rvec) -> ::zp_vec3ld {return ::zp::vsub(::zp::vec3<long double> {lvec.x,lvec.y,lvec.z,},::zp::vec3<long double> {rvec.x,rvec.y,rvec.z,}).cvec();} - auto zp_v4subf( ::zp_vec4f const lvec,::zp_vec4f const rvec) -> ::zp_vec4f {return ::zp::vsub(::zp::vec4<float> {lvec.x,lvec.y,lvec.z,lvec.w,},::zp::vec4<float> {rvec.x,rvec.y,rvec.z,rvec.w,}).cvec();} - auto zp_v4subd( ::zp_vec4d const lvec,::zp_vec4d const rvec) -> ::zp_vec4d {return ::zp::vsub(::zp::vec4<double> {lvec.x,lvec.y,lvec.z,lvec.w,},::zp::vec4<double> {rvec.x,rvec.y,rvec.z,rvec.w,}).cvec();} - auto zp_v4subld(::zp_vec4ld const lvec,::zp_vec4ld const rvec) -> ::zp_vec4ld {return ::zp::vsub(::zp::vec4<long double> {lvec.x,lvec.y,lvec.z,lvec.w,},::zp::vec4<long double> {rvec.x,rvec.y,rvec.z,rvec.w,}).cvec();} + zp_nthrw auto zp_v4subf( ::zp_vec4f const lvec,::zp_vec4f const rvec) -> ::zp_vec4f {return ::zp::vsub(::zp::vec4<float> {lvec.x,lvec.y,lvec.z,lvec.w,},::zp::vec4<float> {rvec.x,rvec.y,rvec.z,rvec.w,}).cvec();} + zp_nthrw auto zp_v4subd( ::zp_vec4d const lvec,::zp_vec4d const rvec) -> ::zp_vec4d {return ::zp::vsub(::zp::vec4<double> {lvec.x,lvec.y,lvec.z,lvec.w,},::zp::vec4<double> {rvec.x,rvec.y,rvec.z,rvec.w,}).cvec();} + zp_nthrw auto zp_v4subld(::zp_vec4ld const lvec,::zp_vec4ld const rvec) -> ::zp_vec4ld {return ::zp::vsub(::zp::vec4<long double> {lvec.x,lvec.y,lvec.z,lvec.w,},::zp::vec4<long double> {rvec.x,rvec.y,rvec.z,rvec.w,}).cvec();} } |