mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 13:52:28 +00:00
Add minor improvements and cleanup
This commit is contained in:
parent
9e3e985ae5
commit
feed0d2b0e
163 changed files with 2286 additions and 2245 deletions
|
@ -21,6 +21,7 @@
|
|||
#include "libc/macros.h"
|
||||
#include "libc/nexgen32e/tinystrlen.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/testlib/ezbench.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
char u8[] = "utf-8 ☻";
|
||||
|
@ -129,3 +130,16 @@ TEST(tinystrnlen16, test) {
|
|||
EXPECT_EQ(2, tinystrnlen16(u"123", 2));
|
||||
EXPECT_EQ(3, tinystrnlen16(u"123", 4));
|
||||
}
|
||||
|
||||
BENCH(strlen, bench) {
|
||||
extern size_t strlen_(const char *) asm("strlen");
|
||||
static char b[1024];
|
||||
memset(b, -1, sizeof(b) - 1);
|
||||
EZBENCH2("strlen 1", donothing, strlen_(""));
|
||||
EZBENCH2("strlen 2", donothing, strlen_("1"));
|
||||
EZBENCH2("strlen 7", donothing, strlen_("123456"));
|
||||
EZBENCH2("strlen 8", donothing, strlen_("1234567"));
|
||||
EZBENCH2("strlen 9", donothing, strlen_("12345678"));
|
||||
EZBENCH2("strlen 16", donothing, strlen_("123456781234567"));
|
||||
EZBENCH2("strlen 1023", donothing, strlen_(b));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue