mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 23:08:31 +00:00
Make AARCH64 harder, better, faster, stronger
- Perform some housekeeping on scalar math function code - Import ARM's Optimized Routines for SIMD string processing - Upgrade to latest Chromium zlib and enable more SIMD optimizations
This commit is contained in:
parent
550b52abf6
commit
cc1732bc42
143 changed files with 15661 additions and 1329 deletions
|
@ -16,17 +16,18 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/mem/gc.internal.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/nexgen32e/crc32.h"
|
||||
#include "libc/nexgen32e/x86feature.h"
|
||||
#include "libc/mem/gc.internal.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/testlib/ezbench.h"
|
||||
#include "libc/testlib/hyperion.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
#include "third_party/zlib/zlib.h"
|
||||
|
||||
#define FANATICS "Fanatics"
|
||||
|
||||
|
|
|
@ -17,18 +17,19 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/assert.h"
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/intrin/asan.internal.h"
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/mem/gc.internal.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/nexgen32e/crc32.h"
|
||||
#include "libc/nexgen32e/x86feature.h"
|
||||
#include "libc/mem/gc.internal.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/testlib/ezbench.h"
|
||||
#include "libc/testlib/hyperion.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
#include "third_party/zlib/zlib.h"
|
||||
|
||||
#define FANATICS "Fanatics"
|
||||
|
||||
|
|
|
@ -15,15 +15,16 @@
|
|||
│ See the License for the specific language governing permissions and │
|
||||
│ limitations under the License. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/str/highwayhash64.h"
|
||||
#include "libc/inttypes.h"
|
||||
#include "libc/nexgen32e/crc32.h"
|
||||
#include "libc/stdio/rand.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/highwayhash64.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/testlib/ezbench.h"
|
||||
#include "libc/testlib/hyperion.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
#include "third_party/zlib/zlib.h"
|
||||
|
||||
#define kMaxSize 64
|
||||
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2022 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/stdio/rand.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/testlib/ezbench.h"
|
||||
#include "libc/testlib/hyperion.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
TEST(memrchr, testNotFoundSse) {
|
||||
char buf[16] = {0};
|
||||
ASSERT_EQ(NULL, memrchr(buf, 1, 16));
|
||||
}
|
||||
|
||||
TEST(memrchr, testNotFoundPure) {
|
||||
char buf[15] = {0};
|
||||
ASSERT_EQ(NULL, memrchr(buf, 1, 15));
|
||||
}
|
||||
|
||||
TEST(memrchr, testSse) {
|
||||
char buf[16];
|
||||
rngset(buf, sizeof(buf), lemur64, -1);
|
||||
ASSERT_EQ(buf + 0, memrchr(buf, buf[0], 16));
|
||||
ASSERT_EQ(buf + 15, memrchr(buf, buf[15], 16));
|
||||
}
|
||||
|
||||
TEST(memrchr, testPure) {
|
||||
char buf[15];
|
||||
rngset(buf, sizeof(buf), lemur64, -1);
|
||||
ASSERT_EQ(buf + 0, memrchr(buf, buf[0], 15));
|
||||
ASSERT_EQ(buf + 14, memrchr(buf, buf[14], 15));
|
||||
}
|
||||
|
||||
TEST(memrchr, testSse2) {
|
||||
char buf[32];
|
||||
rngset(buf, sizeof(buf), lemur64, -1);
|
||||
ASSERT_EQ(buf + 0, memrchr(buf, buf[0], 32));
|
||||
ASSERT_EQ(buf + 15, memrchr(buf, buf[15], 32));
|
||||
ASSERT_EQ(buf + 16, memrchr(buf, buf[16], 32));
|
||||
ASSERT_EQ(buf + 31, memrchr(buf, buf[31], 32));
|
||||
}
|
||||
|
||||
TEST(memrchr, testSsePure) {
|
||||
char buf[20];
|
||||
rngset(buf, sizeof(buf), lemur64, -1);
|
||||
ASSERT_EQ(buf + 0, memrchr(buf, buf[0], 20));
|
||||
ASSERT_EQ(buf + 15, memrchr(buf, buf[15], 20));
|
||||
ASSERT_EQ(buf + 16, memrchr(buf, buf[16], 20));
|
||||
ASSERT_EQ(buf + 19, memrchr(buf, buf[19], 20));
|
||||
}
|
||||
|
||||
BENCH(memrchr, bench) {
|
||||
void *memrchr_(const void *, int, size_t) asm("memrchr");
|
||||
EZBENCH2("memrchr", donothing, memrchr_(kHyperion, 255, kHyperionSize));
|
||||
}
|
|
@ -1,201 +0,0 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/intrin/bits.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/stdio/rand.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/testlib/ezbench.h"
|
||||
#include "libc/testlib/hyperion.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
TEST(strchr, blank) {
|
||||
const char *const blank = "";
|
||||
EXPECT_EQ(NULL, strchr(blank, '#'));
|
||||
EXPECT_EQ(blank, strchr(blank, '\0'));
|
||||
}
|
||||
|
||||
TEST(strchr, text) {
|
||||
char buf[] = "hellothere";
|
||||
EXPECT_STREQ("there", strchr(buf, 't'));
|
||||
}
|
||||
TEST(strchr, testsse) {
|
||||
char buf[] = "hellohellohellohellohellohellohellohello"
|
||||
"theretheretheretheretheretheretherethere";
|
||||
EXPECT_STREQ("theretheretheretheretheretheretherethere", strchr(buf, 't'));
|
||||
}
|
||||
TEST(rawmemchr, text) {
|
||||
char buf[] = "hellothere";
|
||||
EXPECT_STREQ("there", rawmemchr(buf, 't'));
|
||||
}
|
||||
TEST(strchrnul, text) {
|
||||
char buf[] = "hellothere";
|
||||
EXPECT_STREQ("there", strchrnul(buf, 't'));
|
||||
}
|
||||
|
||||
TEST(strchr, nulTerminator) {
|
||||
char buf[] = "hellothere";
|
||||
EXPECT_STREQ("", strchr(buf, '\0'));
|
||||
}
|
||||
TEST(rawmemchr, nulTerminator) {
|
||||
char buf[] = "hellothere";
|
||||
EXPECT_STREQ("", rawmemchr(buf, '\0'));
|
||||
}
|
||||
TEST(strchrnul, nulTerminator) {
|
||||
char buf[] = "hellothere";
|
||||
EXPECT_STREQ("", strchrnul(buf, '\0'));
|
||||
}
|
||||
|
||||
TEST(strchr, notFound_returnsNul) {
|
||||
char buf[] = "hellothere";
|
||||
EXPECT_EQ(NULL, strchr(buf, 'z'));
|
||||
}
|
||||
TEST(strchrnul, notFound_returnsPointerToNulByte) {
|
||||
char buf[] = "hi";
|
||||
EXPECT_STREQ("", strchrnul(buf, 'z'));
|
||||
EXPECT_EQ(&buf[2], strchrnul(buf, 'z'));
|
||||
}
|
||||
|
||||
char *strchr_pure(const char *s, int c) {
|
||||
char *r;
|
||||
for (c &= 0xff;; ++s) {
|
||||
if ((*s & 0xff) == c) return (char *)s;
|
||||
if (!*s) return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
TEST(strchr, fuzz) {
|
||||
char *p;
|
||||
int i, j;
|
||||
p = calloc(1, 64);
|
||||
for (i = -2; i < 257; ++i) {
|
||||
for (j = 0; j < 17; ++j) {
|
||||
rngset(p, 63, rdseed, -1);
|
||||
ASSERT_EQ(strchr_pure(p + j, i), strchr(p + j, i));
|
||||
}
|
||||
}
|
||||
free(p);
|
||||
}
|
||||
|
||||
BENCH(strchr, bench) {
|
||||
EZBENCH2("strchr 0", donothing, EXPROPRIATE(strchr(VEIL("r", ""), 0)));
|
||||
EZBENCH2("strchr 5", donothing, EXPROPRIATE(strchr(VEIL("r", "hello"), 'o')));
|
||||
EZBENCH2("strchr 8", donothing,
|
||||
EXPROPRIATE(strchr(VEIL("r", "hellzzzo"), 'o')));
|
||||
EZBENCH2("strchr 17", donothing,
|
||||
EXPROPRIATE(strchr(VEIL("r", "hellzzzhellzzzeeo"), 'o')));
|
||||
EZBENCH2("strchr 34", donothing,
|
||||
EXPROPRIATE(
|
||||
strchr(VEIL("r", "hellzzzhellzzzeeAhellzzzhellzzzeeo"), 'o')));
|
||||
}
|
||||
|
||||
char *memchr_pure(const char *m, int c, size_t n) {
|
||||
const unsigned char *p, *pe;
|
||||
for (c &= 0xff, p = (const unsigned char *)m, pe = p + n; p < pe; ++p) {
|
||||
if (*p == c) return p;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TEST(memchr, fuzz) {
|
||||
char *p;
|
||||
int i, j;
|
||||
p = malloc(64);
|
||||
for (i = -2; i < 257; ++i) {
|
||||
for (j = 0; j < 17; ++j) {
|
||||
rngset(p, 64, _rand64, -1);
|
||||
ASSERT_EQ(memchr(p + j, i, 64 - j), memchr_pure(p + j, i, 64 - j));
|
||||
}
|
||||
}
|
||||
free(p);
|
||||
}
|
||||
|
||||
char *strchrnul_pure(const char *s, int c) {
|
||||
char *r;
|
||||
for (c &= 0xff;; ++s) {
|
||||
if ((*s & 0xff) == c) return (char *)s;
|
||||
if (!*s) return s;
|
||||
}
|
||||
}
|
||||
|
||||
TEST(strchrnul, fuzz) {
|
||||
char *p;
|
||||
int i, j;
|
||||
p = calloc(1, 64);
|
||||
for (i = -2; i < 257; ++i) {
|
||||
for (j = 0; j < 17; ++j) {
|
||||
rngset(p, 63, _rand64, -1);
|
||||
ASSERT_EQ(strchrnul(p + j, i), strchrnul_pure(p + j, i));
|
||||
}
|
||||
}
|
||||
free(p);
|
||||
}
|
||||
|
||||
void *rawmemchr_pure(const void *m, int c) {
|
||||
const unsigned char *s;
|
||||
for (c &= 255, s = m;; ++s) {
|
||||
if (*s == c) return s;
|
||||
}
|
||||
}
|
||||
|
||||
TEST(rawmemchr, fuzz) {
|
||||
char *p;
|
||||
int i, j;
|
||||
p = malloc(64);
|
||||
for (i = -2; i < 257; ++i) {
|
||||
for (j = 0; j < 17; ++j) {
|
||||
rngset(p, 63, _rand64, -1);
|
||||
p[63] = i;
|
||||
ASSERT_EQ(rawmemchr(p + j, i), rawmemchr_pure(p + j, i));
|
||||
}
|
||||
}
|
||||
free(p);
|
||||
}
|
||||
|
||||
/*
|
||||
* strchr 0 l: 10c 3ns m: 38c 12ns
|
||||
* strchr 5 l: 13c 4ns m: 42c 14ns
|
||||
* strchr 8 l: 14c 5ns m: 44c 14ns
|
||||
* strchr 17 l: 13c 4ns m: 45c 15ns
|
||||
* strchr 34 l: 16c 5ns m: 48c 16ns
|
||||
* strchr z l: 369c 119ns m: 408c 132ns
|
||||
* rawmemchr z l: 236c 76ns m: 391c 126ns
|
||||
* memchr z l: 357c 115ns m: 423c 137ns
|
||||
* strchr Z l: 1,872c 605ns m: 1,911c 617ns
|
||||
* rawmemchr \0 l: 1,184c 382ns m: 1,880c 607ns
|
||||
* strlen l: 1,174c 379ns m: 1,237c 400ns
|
||||
* memchr Z l: 1,866c 603ns m: 1,945c 628ns
|
||||
* strchrnul z l: 365c 118ns m: 408c 132ns
|
||||
* strchrnul Z l: 1,871c 604ns m: 1,914c 618ns
|
||||
*/
|
||||
BENCH(strchr, bench2) {
|
||||
char *strchr_(const char *, int) asm("strchr");
|
||||
char *strchrnul_(const char *, int) asm("strchrnul");
|
||||
char *memchr_(const char *, int, size_t) asm("memchr");
|
||||
char *strlen_(const char *) asm("strlen");
|
||||
char *rawmemchr_(const char *, int) asm("rawmemchr");
|
||||
EZBENCH2("strchr z", donothing, strchr_(kHyperion, 'z'));
|
||||
EZBENCH2("rawmemchr z", donothing, rawmemchr_(kHyperion, 'z'));
|
||||
EZBENCH2("memchr z", donothing, memchr_(kHyperion, 'z', kHyperionSize));
|
||||
EZBENCH2("strchr Z", donothing, strchr_(kHyperion, 'Z'));
|
||||
EZBENCH2("rawmemchr \\0", donothing, rawmemchr_(kHyperion, 0));
|
||||
EZBENCH2("strlen", donothing, strlen_(kHyperion));
|
||||
EZBENCH2("memchr Z", donothing, memchr_(kHyperion, 'Z', kHyperionSize));
|
||||
EZBENCH2("strchrnul z", donothing, strchrnul_(kHyperion, 'z'));
|
||||
EZBENCH2("strchrnul Z", donothing, strchrnul_(kHyperion, 'Z'));
|
||||
}
|
|
@ -472,8 +472,6 @@ TEST(wcscmp, testTwosComplementBane) {
|
|||
TEST(wcsncmp, testTwosComplementBane) {
|
||||
wchar_t *B1 = malloc(4);
|
||||
wchar_t *B2 = malloc(4);
|
||||
B1[1] = L'\0';
|
||||
B2[1] = L'\0';
|
||||
EXPECT_EQ(wcsncmp(memcpy(B1, "\x00\x00\x00\x80", 4),
|
||||
memcpy(B2, "\x00\x00\x00\x80", 4), 1),
|
||||
0);
|
||||
|
|
|
@ -1,119 +0,0 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2020 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
TEST(strrchr, test) {
|
||||
EXPECT_EQ(NULL, strrchr("hello", 'z'));
|
||||
EXPECT_STREQ("lo", strrchr("hello", 'l'));
|
||||
EXPECT_STREQ("llo", strchr("hello", 'l'));
|
||||
EXPECT_STREQ("hello", strrchr("hello", 'h'));
|
||||
EXPECT_STREQ("ello", strrchr("hello", 'e'));
|
||||
EXPECT_STREQ("o", strrchr("hello", 'o'));
|
||||
}
|
||||
|
||||
TEST(strrchr, simdVectorStuffIsntBroken) {
|
||||
EXPECT_EQ(NULL, strrchr("--------------------------------", 'x'));
|
||||
EXPECT_STREQ("x", strrchr("-------------------------------x", 'x'));
|
||||
EXPECT_STREQ("x-------------------------------",
|
||||
strrchr("x-------------------------------", 'x'));
|
||||
EXPECT_STREQ("x"
|
||||
"z-------------------------------",
|
||||
strrchr("x"
|
||||
"z-------------------------------",
|
||||
'x'));
|
||||
EXPECT_STREQ("x-------------------------------"
|
||||
"y-------------------------------",
|
||||
strrchr("x-------------------------------"
|
||||
"y-------------------------------",
|
||||
'x'));
|
||||
EXPECT_STREQ("x"
|
||||
"z-------------------------------"
|
||||
"y-------------------------------",
|
||||
strrchr("x"
|
||||
"z-------------------------------"
|
||||
"y-------------------------------",
|
||||
'x'));
|
||||
}
|
||||
|
||||
TEST(strrchr16, test) {
|
||||
EXPECT_EQ(NULL, strrchr16(u"hello", 'z'));
|
||||
EXPECT_STREQ(u"lo", strrchr16(u"hello", 'l'));
|
||||
EXPECT_STREQ(u"llo", strchr16(u"hello", 'l'));
|
||||
EXPECT_STREQ(u"hello", strrchr16(u"hello", 'h'));
|
||||
EXPECT_STREQ(u"ello", strrchr16(u"hello", 'e'));
|
||||
EXPECT_STREQ(u"o", strrchr16(u"hello", 'o'));
|
||||
}
|
||||
|
||||
TEST(strrchr16, simdVectorStuffIsntBroken) {
|
||||
EXPECT_EQ(NULL, strrchr16(u"--------------------------------", 'x'));
|
||||
EXPECT_STREQ(u"x", strrchr16(u"-------------------------------x", 'x'));
|
||||
EXPECT_STREQ(u"x-------------------------------",
|
||||
strrchr16(u"x-------------------------------", 'x'));
|
||||
EXPECT_STREQ(u"x"
|
||||
u"z-------------------------------",
|
||||
strrchr16(u"x"
|
||||
u"z-------------------------------",
|
||||
'x'));
|
||||
EXPECT_STREQ(u"x-------------------------------"
|
||||
u"y-------------------------------",
|
||||
strrchr16(u"x-------------------------------"
|
||||
u"y-------------------------------",
|
||||
'x'));
|
||||
EXPECT_STREQ(u"x"
|
||||
u"z-------------------------------"
|
||||
u"y-------------------------------",
|
||||
strrchr16(u"x"
|
||||
u"z-------------------------------"
|
||||
u"y-------------------------------",
|
||||
'x'));
|
||||
}
|
||||
|
||||
TEST(wcsrchr, test) {
|
||||
EXPECT_EQ(NULL, wcsrchr(L"hello", 'z'));
|
||||
EXPECT_STREQ(L"lo", wcsrchr(L"hello", 'l'));
|
||||
EXPECT_STREQ(L"llo", wcschr(L"hello", 'l'));
|
||||
EXPECT_STREQ(L"hello", wcsrchr(L"hello", 'h'));
|
||||
EXPECT_STREQ(L"ello", wcsrchr(L"hello", 'e'));
|
||||
EXPECT_STREQ(L"o", wcsrchr(L"hello", 'o'));
|
||||
}
|
||||
|
||||
TEST(wcsrchr, simdVectorStuffIsntBroken) {
|
||||
EXPECT_EQ(NULL, wcsrchr(L"--------------------------------", 'x'));
|
||||
EXPECT_STREQ(L"x", wcsrchr(L"-------------------------------x", 'x'));
|
||||
EXPECT_STREQ(L"x-------------------------------",
|
||||
wcsrchr(L"x-------------------------------", 'x'));
|
||||
EXPECT_STREQ(L"x"
|
||||
L"z-------------------------------",
|
||||
wcsrchr(L"x"
|
||||
L"z-------------------------------",
|
||||
'x'));
|
||||
EXPECT_STREQ(L"x-------------------------------"
|
||||
L"y-------------------------------",
|
||||
wcsrchr(L"x-------------------------------"
|
||||
L"y-------------------------------",
|
||||
'x'));
|
||||
EXPECT_STREQ(L"x"
|
||||
L"z-------------------------------"
|
||||
L"y-------------------------------",
|
||||
wcsrchr(L"x"
|
||||
L"z-------------------------------"
|
||||
L"y-------------------------------",
|
||||
'x'));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue