summaryrefslogtreecommitdiff
path: root/zap
diff options
context:
space:
mode:
Diffstat (limited to 'zap')
-rw-r--r--zap/GNUmakefile14
-rw-r--r--zap/source/any/math/abs.c (renamed from zap/source/any/mth/abs.c)0
-rw-r--r--zap/source/any/math/div0.c (renamed from zap/source/any/mth/div0.c)0
-rw-r--r--zap/source/any/math/divmod.c (renamed from zap/source/any/mth/divmod.c)0
-rw-r--r--zap/source/any/math/exp.c24
5 files changed, 32 insertions, 6 deletions
diff --git a/zap/GNUmakefile b/zap/GNUmakefile
index 9c85885..c8993ff 100644
--- a/zap/GNUmakefile
+++ b/zap/GNUmakefile
@@ -14,6 +14,7 @@ OBJ_BS_TRAP := source/any/bs/trap.o
OBJ_MATH_ABS := source/any/math/abs.o
OBJ_MATH_DIV0 := source/any/math/div0.o
OBJ_MATH_DIVMOD := source/any/math/divmod.o
+OBJ_MATH_EXP := source/any/math/exp.o
OBJ_MEM_CP := source/any/mem/cp.o
OBJ_MEM_EQ := source/any/mem/eq.o
OBJ_MEM_FILL := source/any/mem/fill.o
@@ -26,8 +27,8 @@ OBJ_MEM_WIN1252DEC := source/any/mem/win1252dec.o
OBJ_MEM_WIN1252ENC := source/any/mem/win1252enc.o
ifeq "$(arch)" "amd64"
-OBJ_MATH_ABS := source/$(arch)/math/abs
-OBJ_MEM_CP := source/$(arch)/mem/cp.o.o
+OBJ_MATH_ABS := source/$(arch)/math/abs.o
+OBJ_MEM_CP := source/$(arch)/mem/cp.o
else ifeq "$(arch)" "arm64"
OBJ_MATH_ABS := source/$(arch)/math/abs
OBJ_MEM_CP := source/$(arch)/mem/cp.o
@@ -35,6 +36,10 @@ endif
OBJS := \
$(OBJ_BS_TRAP) \
+ $(OBJ_MATH_ABS) \
+ $(OBJ_MATH_DIV0) \
+ $(OBJ_MATH_DIVMOD) \
+ $(OBJ_MATH_EXP) \
$(OBJ_MEM_CP) \
$(OBJ_MEM_EQ) \
$(OBJ_MEM_FILL) \
@@ -44,10 +49,7 @@ OBJS := \
$(OBJ_MEM_UTF8ENC) \
$(OBJ_MEM_UTF8ENCLEN) \
$(OBJ_MEM_WIN1252DEC) \
- $(OBJ_MEM_WIN1252ENC) \
- $(OBJ_MATH_ABS) \
- $(OBJ_MATH_DIV0) \
- $(OBJ_MATH_DIVMOD)
+ $(OBJ_MEM_WIN1252ENC)
LIB := libzap.a
diff --git a/zap/source/any/mth/abs.c b/zap/source/any/math/abs.c
index d12b6a6..d12b6a6 100644
--- a/zap/source/any/mth/abs.c
+++ b/zap/source/any/math/abs.c
diff --git a/zap/source/any/mth/div0.c b/zap/source/any/math/div0.c
index 87fcfa0..87fcfa0 100644
--- a/zap/source/any/mth/div0.c
+++ b/zap/source/any/math/div0.c
diff --git a/zap/source/any/mth/divmod.c b/zap/source/any/math/divmod.c
index 4214651..4214651 100644
--- a/zap/source/any/mth/divmod.c
+++ b/zap/source/any/math/divmod.c
diff --git a/zap/source/any/math/exp.c b/zap/source/any/math/exp.c
new file mode 100644
index 0000000..6c16213
--- /dev/null
+++ b/zap/source/any/math/exp.c
@@ -0,0 +1,24 @@
+/*
+ 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>.
+*/
+
+#include <zap/math.h>
+
+#define zap_priv_exp(_wdth) \
+zap_i##_wdth zap_exp##_wdth(zap_i##_wdth const _val,zap_i##_wdth const _n) { \
+ if (_val == 0x0) { \
+ return 0x1u; \
+ } \
+ zap_i##_wdth val = _val; \
+ for (zap_i##_wdth i = 0x1u;i < _n;++i) { \
+ val *= _val; \
+ } \
+ return val; \
+}
+
+zap_priv_exp(8)
+zap_priv_exp(01)
+zap_priv_exp(02)
+zap_priv_exp(04)