summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.txt7
-rw-r--r--test/source/main.c8
-rw-r--r--test/source/test/memcat.i43
-rw-r--r--test/source/test/strcat.i19
-rw-r--r--zap/GNUmakefile2
-rw-r--r--zap/include/zap/bs.h2
-rw-r--r--zap/include/zap/mem.h6
-rw-r--r--zap/source/amd64/mem/memcat.c14
-rw-r--r--zap/source/amd64/mem/memfnd.S2
-rw-r--r--zap/source/amd64/mem/strcat.c19
-rw-r--r--zap/source/amd64/mem/strfnd.S2
11 files changed, 14 insertions, 110 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index e6cec54..aa4154a 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,3 +1,10 @@
+# 14.0
+
+* memcat: Remove;
+* strcat: Remove;
+* memcp: Return number of copied bytes;
+* memfill: Return number of filled bytes;
+
# 13.1
* Implement memcnt in assembly;
diff --git a/test/source/main.c b/test/source/main.c
index 0d5ea85..3e33c35 100644
--- a/test/source/main.c
+++ b/test/source/main.c
@@ -19,7 +19,6 @@ typedef bool (* zaptest_testtyp)(void);
#include "test/bool.i"
#include "test/cmp.i"
-#include "test/memcat.i"
#include "test/memcnt.i"
#include "test/memcp.i"
#include "test/memeq.i"
@@ -28,7 +27,6 @@ typedef bool (* zaptest_testtyp)(void);
#include "test/memfor.i"
#include "test/memgen.i"
#include "test/nullptr.i"
-#include "test/strcat.i"
#include "test/strcp.i"
#include "test/streq.i"
#include "test/strfill.i"
@@ -43,7 +41,6 @@ typedef bool (* zaptest_testtyp)(void);
static zaptest_testtyp zaptest_tests[] = {
zaptest_test_bool,
zaptest_test_cmp,
- zaptest_test_memcat,
zaptest_test_memcnt,
zaptest_test_memcp,
zaptest_test_memeq,
@@ -52,7 +49,6 @@ static zaptest_testtyp zaptest_tests[] = {
zaptest_test_memfor,
zaptest_test_memgen,
zaptest_test_nullptr,
- zaptest_test_strcat,
zaptest_test_strcp,
zaptest_test_streq,
zaptest_test_strfill,
@@ -66,9 +62,10 @@ static zaptest_testtyp zaptest_tests[] = {
};
static char const * zaptest_testnms[] = {
+ "abs",
+ "add",
"bool",
"cmp",
- "memcat",
"memcnt",
"memcp",
"memeq",
@@ -77,7 +74,6 @@ static char const * zaptest_testnms[] = {
"memfor",
"memgen",
"nullptr",
- "strcat",
"strcp",
"streq",
"strfill",
diff --git a/test/source/test/memcat.i b/test/source/test/memcat.i
deleted file mode 100644
index f16faef..0000000
--- a/test/source/test/memcat.i
+++ /dev/null
@@ -1,43 +0,0 @@
-#include <stdbool.h>
-
-static bool zaptest_test_memcat(void) {
- unsigned short const arr0[] = {
- 0x1u,
- 0x3u,
- 0x7u,
- 0xFu,
- 0x1Fu,
- 0x3Fu,
- 0x7Fu,
- 0xFFu,
- };
- unsigned short const arr1[] = {
- 0x1FFu,
- 0x3FFu,
- 0x7FFu,
- 0xFFFu,
- 0x1FFFu,
- 0x3FFFu,
- 0x7FFFu,
- 0xFFFFu,
- };
- unsigned short buf[(sizeof (arr0) + sizeof (arr1)) / sizeof (arr0[0x0u])];
- zap_memcat(arr0,sizeof (arr0),arr1,sizeof (arr1),buf);
- zaptest_chk(buf[0x0u],0x1u, unsigned int,"%X");
- zaptest_chk(buf[0x1u],0x3u, unsigned int,"%X");
- zaptest_chk(buf[0x2u],0x7u, unsigned int,"%X");
- zaptest_chk(buf[0x3u],0xFu, unsigned int,"%X");
- zaptest_chk(buf[0x4u],0x1F, unsigned int,"%X");
- zaptest_chk(buf[0x5u],0x3Fu, unsigned int,"%X");
- zaptest_chk(buf[0x6u],0x7Fu, unsigned int,"%X");
- zaptest_chk(buf[0x7u],0xFFu, unsigned int,"%X");
- zaptest_chk(buf[0x8u],0x1FFu, unsigned int,"%X");
- zaptest_chk(buf[0x9u],0x3FFu, unsigned int,"%X");
- zaptest_chk(buf[0xAu],0x7FFu, unsigned int,"%X");
- zaptest_chk(buf[0xBu],0xFFFu, unsigned int,"%X");
- zaptest_chk(buf[0xCu],0x1FFFu,unsigned int,"%X");
- zaptest_chk(buf[0xDu],0x3FFFu,unsigned int,"%X");
- zaptest_chk(buf[0xEu],0x7FFFu,unsigned int,"%X");
- zaptest_chk(buf[0xFu],0xFFFFu,unsigned int,"%X");
- return false;
-}
diff --git a/test/source/test/strcat.i b/test/source/test/strcat.i
deleted file mode 100644
index e037b88..0000000
--- a/test/source/test/strcat.i
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdbool.h>
-
-static bool zaptest_test_strcat(void) {
- char const str0[] = "u r ";
- char const str1[] = "mr gay";
- char buf[sizeof (str0) + sizeof (str1)];
- zap_strcat(str0,str1,buf);
- zaptest_chk(buf[0x0u],'u',char,"'%c'");
- zaptest_chk(buf[0x1u],' ',char,"'%c'");
- zaptest_chk(buf[0x2u],'r',char,"'%c'");
- zaptest_chk(buf[0x3u],' ',char,"'%c'");
- zaptest_chk(buf[0x4u],'m',char,"'%c'");
- zaptest_chk(buf[0x5u],'r',char,"'%c'");
- zaptest_chk(buf[0x6u],' ',char,"'%c'");
- zaptest_chk(buf[0x7u],'g',char,"'%c'");
- zaptest_chk(buf[0x8u],'a',char,"'%c'");
- zaptest_chk(buf[0x9u],'y',char,"'%c'");
- return false;
-}
diff --git a/zap/GNUmakefile b/zap/GNUmakefile
index 18f94eb..46ced95 100644
--- a/zap/GNUmakefile
+++ b/zap/GNUmakefile
@@ -35,7 +35,6 @@ CPPFLAGS := \
# ARTEFACTS
OBJS = \
- source/$(arch)/mem/memcat.o \
source/$(arch)/mem/memcnt.o \
source/$(arch)/mem/memcp.o \
source/$(arch)/mem/memeq.o \
@@ -43,7 +42,6 @@ OBJS = \
source/$(arch)/mem/memfnd.o \
source/$(arch)/mem/memfor.o \
source/$(arch)/mem/memgen.o \
- source/$(arch)/mem/strcat.o \
source/$(arch)/mem/streq.o \
source/$(arch)/mem/strfill.o \
source/$(arch)/mem/strfnd.o \
diff --git a/zap/include/zap/bs.h b/zap/include/zap/bs.h
index 7e14502..6c2815d 100644
--- a/zap/include/zap/bs.h
+++ b/zap/include/zap/bs.h
@@ -24,7 +24,7 @@ typedef signed char zap_cmp;
#define zap_gt ((zap_cmp)+0x7F)
#define zap_lt ((zap_cmp)-0x80)
-#define zap_nopos (~((zap_sz)+0u))
+#define zap_nopos ((zap_sz)+0xFFFFFFFFFFFFFFFFu)
#define zap_nullptr (0x0u)
diff --git a/zap/include/zap/mem.h b/zap/include/zap/mem.h
index 8bcaa0b..d32a910 100644
--- a/zap/include/zap/mem.h
+++ b/zap/include/zap/mem.h
@@ -13,15 +13,13 @@
extern "C" {
#endif
-__attribute__ ((hot,nothrow)) void zap_memcat( void const * lptr, zap_sz llen,void const * rptr, zap_sz rlen, void * buf);
__attribute__ ((hot,warn_unused_result)) zap_sz zap_memcnt( void const * ptr, zap_sz sz, zap_sz num, zap_bool (* fn)(void const *));
-__attribute__ ((hot,nothrow)) void zap_memcp( void const * in, zap_sz num, void * out);
+__attribute__ ((hot,nothrow)) zap_sz zap_memcp( void const * in, zap_sz num, void * out);
__attribute__ ((hot,nothrow,warn_unused_result)) zap_bool zap_memeq( void const * lptr, zap_sz num, void const * rptr);
-__attribute__ ((hot,nothrow)) void zap_memfill( void * ptr, zap_sz num, unsigned char val);
+__attribute__ ((hot,nothrow)) zap_sz zap_memfill( void * ptr, zap_sz num, unsigned char val);
__attribute__ ((hot,nothrow,warn_unused_result)) zap_sz zap_memfnd( void const * ptr, zap_sz num, unsigned char byte);
__attribute__ ((hot)) void zap_memfor( void * ptr, zap_sz sz, zap_sz num, void (* fn)(void *));
__attribute__ ((hot)) void zap_memgen( void * ptr, zap_sz sz, zap_sz num, void (* fn)(zap_sz,void *));
-__attribute__ ((hot,nothrow)) void zap_strcat( char const * lstr, char const * rstr,char * buf);
__attribute__ ((hot,nothrow)) zap_sz zap_strcp( char const * in, char * out);
__attribute__ ((hot,nothrow,warn_unused_result)) zap_bool zap_streq( char const * lstr, char const * rstr);
__attribute__ ((hot,nothrow)) zap_sz zap_strfill( char * lstr, char chr);
diff --git a/zap/source/amd64/mem/memcat.c b/zap/source/amd64/mem/memcat.c
deleted file mode 100644
index 2b50ba7..0000000
--- a/zap/source/amd64/mem/memcat.c
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- Copyright 2022 Gabriel Jensen.
- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
- If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
-*/
-
-#include <zap/priv.h>
-
-#include <zap/mem.h>
-
-void zap_memcat(void const * const _lptr,zap_sz const _llen,void const * const _rptr,zap_sz const _rlen,void * const _buf) {
- zap_memcp(_lptr,_llen,_buf);
- zap_memcp(_rptr,_rlen,(unsigned char *)_buf + _llen);
-}
diff --git a/zap/source/amd64/mem/memfnd.S b/zap/source/amd64/mem/memfnd.S
index 0b5a47e..e1f8c30 100644
--- a/zap/source/amd64/mem/memfnd.S
+++ b/zap/source/amd64/mem/memfnd.S
@@ -46,5 +46,5 @@ zap_memfnd:
# Not found:
.nfnd:
- movq $0xFFFFFFFFFFFFFFFF,addr # addr = FFFFFFFFFFFFFFFF
+ movq $0xFFFFFFFFFFFFFFFF,addr # addr = 0xFFFFFFFFFFFFFFFF
ret # return addr
diff --git a/zap/source/amd64/mem/strcat.c b/zap/source/amd64/mem/strcat.c
deleted file mode 100644
index f7f66c8..0000000
--- a/zap/source/amd64/mem/strcat.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- Copyright 2022 Gabriel Jensen.
- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
- If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
-*/
-
-#include <zap/priv.h>
-
-#include <zap/mem.h>
-
-#include <stddef.h>
-
-void zap_strcat(char const * const _lstr,char const * const _rstr,char * const _buf) {
- zap_sz const llen = zap_strlen (_lstr);
- zap_sz const rlen = zap_strlen (_rstr);
- zap_memcp(_lstr,llen,_buf);
- zap_memcp(_rstr,rlen,_buf + llen);
- _buf[llen + rlen] = '\x0';
-}
diff --git a/zap/source/amd64/mem/strfnd.S b/zap/source/amd64/mem/strfnd.S
index d9c99f3..f2f94fa 100644
--- a/zap/source/amd64/mem/strfnd.S
+++ b/zap/source/amd64/mem/strfnd.S
@@ -44,5 +44,5 @@ zap_strfnd:
# Not found:
.nfnd:
- movq $0xFFFFFFFFFFFFFFFF,addr # addr = FFFFFFFFFFFFFFFF
+ movq $0xFFFFFFFFFFFFFFFF,addr # addr = 0xFFFFFFFFFFFFFFFF
ret # return addr