mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-03 01:38:30 +00:00
Add more missing C / C++ headers
This commit is contained in:
parent
b9dc74b672
commit
8dd4ec68d0
152 changed files with 30711 additions and 6267 deletions
|
@ -19,8 +19,8 @@
|
|||
#include "libc/dce.h"
|
||||
#include "libc/intrin/asan.internal.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/stdio/rand.h"
|
||||
#include "libc/runtime/gc.internal.h"
|
||||
#include "libc/stdio/rand.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/testlib/ezbench.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
@ -68,11 +68,18 @@ TEST(bzero, hug) {
|
|||
BENCH(memset, bench) {
|
||||
int n, max = 8 * 1024 * 1024;
|
||||
char *volatile p = gc(malloc(max));
|
||||
|
||||
EZBENCH_N("memset", 0, memset(p, -1, 0));
|
||||
for (n = 2; n <= max; n *= 2) {
|
||||
EZBENCH_N("memset", n - 1, memset(p, -1, n - 1));
|
||||
EZBENCH_N("memset", n, memset(p, -1, n));
|
||||
}
|
||||
|
||||
EZBENCH_N("memset16", 0, memset16((char16_t *)p, -1, 0));
|
||||
for (n = 2; n <= max; n *= 2) {
|
||||
EZBENCH_N("memset16", n, memset16((char16_t *)p, -1, n / 2));
|
||||
}
|
||||
|
||||
EZBENCH_N("bzero", 0, bzero(p, 0));
|
||||
for (n = 2; n <= max; n *= 2) {
|
||||
EZBENCH_N("bzero", n - 1, bzero(p, n - 1));
|
||||
|
|
|
@ -16,15 +16,15 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/mem/alg.h"
|
||||
#include "libc/limits.h"
|
||||
#include "libc/log/log.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/mem/alg.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/nexgen32e/nexgen32e.h"
|
||||
#include "libc/nexgen32e/x86feature.h"
|
||||
#include "libc/stdio/rand.h"
|
||||
#include "libc/runtime/gc.internal.h"
|
||||
#include "libc/stdio/rand.h"
|
||||
#include "libc/stdio/stdio.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/testlib/ezbench.h"
|
||||
|
@ -35,6 +35,20 @@ void djbsort_avx2(int32_t *, long);
|
|||
size_t n;
|
||||
int32_t *a, *b, *c;
|
||||
|
||||
void insertionsort(int32_t *a, size_t n) {
|
||||
int t;
|
||||
unsigned i, j;
|
||||
for (i = 1; i < n; ++i) {
|
||||
j = i;
|
||||
t = a[i];
|
||||
while (j > 0 && t < a[j - 1]) {
|
||||
a[j] = a[j - 1];
|
||||
--j;
|
||||
}
|
||||
a[j] = t;
|
||||
}
|
||||
}
|
||||
|
||||
TEST(djbsort, test4) {
|
||||
static const int kA[] = {4, 3, 2, 1};
|
||||
n = ARRAYLEN(kA);
|
||||
|
|
|
@ -31,6 +31,4 @@ TEST(wmemrchr, test) {
|
|||
BENCH(wmemrchr, bench) {
|
||||
EZBENCH2("wmemrchr", donothing,
|
||||
EXPROPRIATE(wmemrchr(L"yo.hi.there", '.', 11)));
|
||||
EZBENCH2("wmemrchr hyperion", donothing,
|
||||
EXPROPRIATE(wmemrchr(kHyperion, '.', kHyperionSize / 4)));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue