Initial import

This commit is contained in:
Justine Tunney 2020-06-15 07:18:57 -07:00
commit c91b3c5006
14915 changed files with 590219 additions and 0 deletions

View file

@ -0,0 +1,65 @@
/*-*- 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
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "dsp/tty/quant.h"
#include "libc/testlib/testlib.h"
struct TtyRgb res;
TEST(rgb2ansi, testDesaturatedPurple_isQuantizedBetterThanEuclideanDistance) {
ttyquantinit(kTtyQuantXterm256, kTtyQuantRgb, kTtyBlocksUnicode);
/*
* the challenge to the xterm256 palette is that it was likely
* intended for just syntax highlighting, rather than accurately
* modeling the natural phenomenon of illumination.
*
* as a syntax highlighting palette, it focuses mostly on bright
* saturated colors, while also providing a really good greyscale for
* everything else.
*
* as such, if one were to project the colors of this palette into a
* three-dimensional space, we might see something like an HSV cone,
* where all the color samples are projected mostly around the outside
* of the cone, and the greyscale dots tracing through the middle.
*
* if we want to convert an a real color into an xterm color, we can
* use euclidean distance functions to pick the closest color, such as
* sum of squared distance. however this will only work well if it's
* either a pure grey color, or a bright saturated one.
*
* but euclidean distance doesnt work well for the sorts of colors
* that are generally used for things like film, which conservatively
* edits for the colors more towards the middle of the space; and as
* such, which basically causes the distance function to pick greys
* for almost everything.
*/
res = rgb2tty(0x56, 0x38, 0x66);
/* EXPECT_NE(0x4e, res.r); */
/* EXPECT_NE(0x4e, res.g); */
/* EXPECT_NE(0x4e, res.b); */
/* EXPECT_NE(239, res.xt); */
/* EXPECT_EQ(0x5f, res.r); */
/* EXPECT_EQ(0x00, res.g); */
/* EXPECT_EQ(0x5f, res.b); */
/* EXPECT_EQ(53, res.xt); */
}

View file

@ -0,0 +1,47 @@
/*-*- 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
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "dsp/tty/rgb2xterm256.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/testlib.h"
TEST(rgb2xterm256, test) {
EXPECT_EQ(196, rgb2xterm256v2(0xff, 0x00, 0x00)); /* red */
EXPECT_EQ(46, rgb2xterm256v2(0x00, 0xff, 0x00)); /* green */
EXPECT_EQ(21, rgb2xterm256v2(0x00, 0x00, 0xff)); /* blue */
EXPECT_EQ(226, rgb2xterm256v2(0xff, 0xff, 0x00)); /* yellow */
EXPECT_EQ(208, rgb2xterm256v2(0xff, 0x80, 0x00)); /* orange */
}
TEST(rgb2xterm256, testRedBlack) {
EXPECT_EQ(16, rgb2xterm256v2(0, 0, 0));
EXPECT_EQ(16, rgb2xterm256v2(12, 0, 0));
EXPECT_EQ(232, rgb2xterm256v2(13, 0, 0));
EXPECT_EQ(233, rgb2xterm256v2(39, 0, 0));
EXPECT_EQ(233, rgb2xterm256v2(40, 0, 0));
EXPECT_EQ(52, rgb2xterm256v2(53, 0, 0));
EXPECT_EQ(88, rgb2xterm256v2(115, 0, 0));
EXPECT_EQ(88, rgb2xterm256v2(116, 0, 0));
}
////////////////////////////////////////////////////////////////////////////////
BENCH(rgb2xterm256v2, bench) {
EZBENCH(donothing, rgb2xterm256v2(0xff, 0x80, 0x00));
}

51
test/dsp/tty/test.mk Normal file
View file

@ -0,0 +1,51 @@
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐
#───vi: set et ft=make ts=8 tw=8 fenc=utf-8 :vi───────────────────────┘
PKGS += TEST_DSP_TTY
TEST_DSP_TTY_SRCS := $(wildcard test/dsp/tty/*.c)
TEST_DSP_TTY_SRCS_TEST = $(filter %_test.c,$(TEST_DSP_TTY_SRCS))
TEST_DSP_TTY_COMS = $(TEST_DSP_TTY_OBJS:%.o=%.com)
TEST_DSP_TTY_BINS = $(TEST_DSP_TTY_COMS) $(TEST_DSP_TTY_COMS:%=%.dbg)
TEST_DSP_TTY_OBJS = \
$(TEST_DSP_TTY_SRCS:%=o/$(MODE)/%.zip.o) \
$(TEST_DSP_TTY_SRCS:%.c=o/$(MODE)/%.o)
TEST_DSP_TTY_TESTS = \
$(TEST_DSP_TTY_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
TEST_DSP_TTY_CHECKS = \
$(TEST_DSP_TTY_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
TEST_DSP_TTY_DIRECTDEPS = \
DSP_TTY \
LIBC_TINYMATH \
LIBC_LOG \
LIBC_RUNTIME \
LIBC_RAND \
LIBC_NEXGEN32E \
LIBC_STR \
LIBC_STUBS \
LIBC_TESTLIB
TEST_DSP_TTY_DEPS := \
$(call uniq,$(foreach x,$(TEST_DSP_TTY_DIRECTDEPS),$($(x))))
o/$(MODE)/test/dsp/tty/tty.pkg: \
$(TEST_DSP_TTY_OBJS) \
$(foreach x,$(TEST_DSP_TTY_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/test/dsp/tty/%.com.dbg: \
$(TEST_DSP_TTY_DEPS) \
o/$(MODE)/test/dsp/tty/%.o \
o/$(MODE)/test/dsp/tty/tty.pkg \
$(LIBC_TESTMAIN) \
$(CRT) \
$(APE)
@$(APELINK)
.PHONY: o/$(MODE)/test/dsp/tty
o/$(MODE)/test/dsp/tty: \
$(TEST_DSP_TTY_BINS) \
$(TEST_DSP_TTY_CHECKS)

191
test/dsp/tty/ttymove_test.c Normal file
View file

@ -0,0 +1,191 @@
/*-*- 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
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "dsp/tty/tty.h"
#include "libc/bits/bits.h"
#include "libc/rand/rand.h"
#include "libc/str/str.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/testlib.h"
char p[16];
struct TtyCursor c;
void SetUp(void) { rngset(p, sizeof(p), rand64, -1); }
TEST(ttymove, sameCoord_doesNothing) {
c.y = 0;
c.x = 0;
EXPECT_EQ(0, ttymove(&c, p, 0, 0) - p);
EXPECT_STREQ("", p);
EXPECT_EQ(0, c.y);
EXPECT_EQ(0, c.x);
}
TEST(ttymove, crlf) {
c.y = 0;
c.x = 10;
EXPECT_EQ(2, ttymove(&c, p, 1, 0) - p);
EXPECT_STREQ("\r\n", p);
EXPECT_EQ(1, c.y);
EXPECT_EQ(0, c.x);
}
TEST(ttymove, cr) {
c.y = 7;
c.x = 10;
EXPECT_EQ(1, ttymove(&c, p, 7, 0) - p);
EXPECT_STREQ("\r", p);
EXPECT_EQ(7, c.y);
EXPECT_EQ(0, c.x);
}
TEST(ttymove, forwardOne) {
c.y = 0;
c.x = 10;
EXPECT_EQ(3, ttymove(&c, p, 0, 11) - p);
EXPECT_STREQ("\e[C", p);
EXPECT_EQ(0, c.y);
EXPECT_EQ(11, c.x);
}
TEST(ttymove, forwardTwo) {
c.y = 0;
c.x = 0;
EXPECT_EQ(4, ttymove(&c, p, 0, 2) - p);
EXPECT_STREQ("\e[2C", p);
EXPECT_EQ(0, c.y);
EXPECT_EQ(2, c.x);
}
TEST(ttymove, forwardHuge_moves255increments) {
c.y = 0;
c.x = 0;
EXPECT_EQ(6 + 3, ttymove(&c, p, 0, 256) - p);
EXPECT_STREQ("\e[255C\e[C", p);
EXPECT_EQ(0, c.y);
EXPECT_EQ(256, c.x);
}
TEST(ttymove, topleft) {
c.y = 1000;
c.x = 888;
EXPECT_EQ(3, ttymove(&c, p, 0, 0) - p);
EXPECT_STREQ("\e[H", p);
EXPECT_EQ(0, c.y);
EXPECT_EQ(0, c.x);
}
#define MOVE(WANT, Y, X) \
EXPECT_EQ(strlen(WANT), ttymove(&c, p, Y, X) - p); \
EXPECT_STREQ(WANT, p); \
EXPECT_EQ(Y, c.y); \
EXPECT_EQ(X, c.x)
TEST(ttymove, absoluteYandX_is1indexed) {
c.y = 1000;
c.x = 888;
MOVE("\e[4;3H", 3, 2);
}
TEST(ttymove, absoluteYandX_implicit1y) {
c.y = 1000;
c.x = 888;
MOVE("\e[;3H", 0, 2);
}
TEST(ttymove, absoluteYandX_implicit1x) {
c.y = 1000;
c.x = 888;
MOVE("\e[4H", 3, 0);
}
TEST(ttymove, up) {
c.y = 70, c.x = 70;
MOVE("\eM", 69, 70);
c.y = 70, c.x = 70;
MOVE("\e[2A", 68, 70);
}
TEST(ttymove, down) {
c.y = 70, c.x = 70;
MOVE("\eD", 71, 70);
c.y = 70, c.x = 70;
MOVE("\e[2B", 72, 70);
}
TEST(ttymove, right) {
c.y = 70, c.x = 70;
MOVE("\e[C", 70, 71);
c.y = 70, c.x = 70;
MOVE("\e[2C", 70, 72);
c.y = 70, c.x = 0;
MOVE("\e[123C", 70, 123);
}
TEST(ttymove, left) {
c.y = 70, c.x = 70;
MOVE("\e[D", 70, 69);
c.y = 70, c.x = 70;
MOVE("\e[2D", 70, 68);
}
/* TEST(ttymove, bench_absmove) { */
/* EZBENCH( */
/* { */
/* c.y = 70; */
/* c.x = 30; */
/* }, */
/* ttymove(&c, p, 7, 9)); */
/* ASSERT_STREQ("\e[8;10H", p); */
/* } */
/* TEST(ttymove, bench_crlf) { */
/* EZBENCH( */
/* { */
/* c.y = 0; */
/* c.x = 10; */
/* }, */
/* ttymove(&c, p, 1, 0)); */
/* ASSERT_STREQ("\r\n", p); */
/* } */
/* TEST(ttymove, bench_forward1) { */
/* EZBENCH( */
/* { */
/* c.y = 0; */
/* c.x = 10; */
/* }, */
/* ttymove(&c, p, 0, 11)); */
/* ASSERT_STREQ("\e[C", p); */
/* } */
/* TEST(ttymove, bench_forward2) { */
/* int y2, x2; */
/* EZBENCH( */
/* { */
/* y2 = rand32() & 127; */
/* x2 = rand32() & 127; */
/* c.y = rand32() & 127; */
/* c.x = rand32() & 127; */
/* }, */
/* ttymove(&c, p, y2, x2)); */
/* int z; */
/* EZBENCH(z = rand32() & 127, _memcpy(&z, "\e[2C", 4)); */
/* } */

View file

@ -0,0 +1,152 @@
/*-*- 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
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "dsp/tty/quant.h"
#include "libc/bits/progn.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/testlib.h"
#include "net/http/csscolor.h"
/*TODO(jart): Re-enable me
static const struct TtyRgb kBlack = {0, 0, 0, 16};
static const struct TtyRgb kWhite = {255, 255, 255, 231};
static const struct TtyRgb kRed = {0xff, 0, 0, 196};
char vtbuf[128];
void ttyraster_true_setup(void) {
ttyquantinit(kTtyQuantTrue, kTtyQuantRgb, kTtyBlocksUnicode);
}
void ttyraster2x2_true(void) {
ttyraster(vtbuf,
(const struct TtyRgb *)(unsigned[2][2]){
{DARKRED, GRAY1},
{DARKRED, DARKRED},
},
2, 2, kBlack, kBlack);
}
TEST(ttyraster, testCorner) {
ttyraster_true_setup();
EXPECT_STREQ("\e[48;2;139;0;0;38;2;3;3;3m▝",
PROGN(ttyraster2x2_true(), vtbuf));
}
TEST(ttyraster, testFullBlock_favorsSpace) {
ttyquantinit(kTtyQuantTrue, kTtyQuantRgb, kTtyBlocksUnicode);
ttyraster(vtbuf,
(struct TtyRgb *)(unsigned[2][2]){
{DARKRED, DARKRED},
{DARKRED, DARKRED},
},
2, 2, kBlack, kBlack);
EXPECT_STREQ("\e[48;2;139;0;0m ", vtbuf);
}
TEST(ttyraster, testFullBlock_favorsUnicodeWhenCurrenttFgMatchesButNotBg) {
ttyquantinit(kTtyQuantTrue, kTtyQuantRgb, kTtyBlocksUnicode);
ttyraster(vtbuf,
(struct TtyRgb *)(unsigned[2][4]){
{DARKRED, GRAY1, GRAY1, GRAY1},
{DARKRED, DARKRED, GRAY1, GRAY1},
},
2, 4, kBlack, kBlack);
EXPECT_STREQ("\e[48;2;139;0;0;38;2;3;3;3m▝█", vtbuf);
}
TEST(ttyraster, testFullBlock_forcesSwitchBackToSpaceForRuns) {
ttyquantinit(kTtyQuantTrue, kTtyQuantRgb, kTtyBlocksUnicode);
ttyraster(vtbuf,
(struct TtyRgb *)(unsigned[2][8]){
{DARKRED, GRAY1, GRAY1, GRAY1, GRAY1, GRAY1, GRAY1, GRAY1},
{DARKRED, DARKRED, GRAY1, GRAY1, GRAY1, GRAY1, GRAY1, GRAY1},
},
2, 8, kBlack, kBlack);
EXPECT_STREQ("\e[48;2;139;0;0;38;2;3;3;3m▝█\e[48;2;3;3;3m ", vtbuf);
}
////////////////////////////////////////////////////////////////////////////////
TEST(ttyraster_cp437, testSide) {
ttyquantinit(kTtyQuantTrue, kTtyQuantRgb, kTtyBlocksCp437);
ttyraster(vtbuf,
(const struct TtyRgb *)(unsigned[2][2]){
{DARKRED, GRAY1},
{DARKRED, GRAY1},
},
2, 2, kBlack, kBlack);
EXPECT_STREQ("\e[48;2;3;3;3;38;2;139;0;0m▌", vtbuf);
}
////////////////////////////////////////////////////////////////////////////////
void ttyraster_xterm256_setup(void) {
ttyquantinit(kTtyQuantXterm256, kTtyQuantRgb, kTtyBlocksUnicode);
}
void ttyraster2x2_xterm256(void) {
ttyraster(vtbuf,
(const struct TtyRgb *)(struct TtyRgb[2][2]){
{kBlack, kWhite},
{kBlack, kBlack},
},
2, 2, kRed, kRed);
}
TEST(ttyraster_xterm256, testCorner) {
ttyraster_xterm256_setup();
ttyraster2x2_xterm256();
EXPECT_STREQ("\e[48;5;16;38;5;231m▝", vtbuf);
}
void ttyraster6x2_xterm256(void) {
ttyraster(vtbuf,
(const struct TtyRgb *)(struct TtyRgb[2][6]){
{kBlack, kWhite, kBlack, kWhite, kBlack, kWhite},
{kBlack, kBlack, kBlack, kBlack, kBlack, kBlack},
},
2, 6, kRed, kRed);
}
TEST(ttyraster_xterm256, testCornerRepeat3) {
ttyraster_xterm256_setup();
ttyraster6x2_xterm256();
EXPECT_STREQ("\e[48;5;16;38;5;231m▝▝▝", vtbuf);
}
////////////////////////////////////////////////////////////////////////////////
BENCH(ttyraster_true, bench) {
ttyraster_true_setup();
EZBENCH(donothing, ttyraster2x2_true());
}
BENCH(ttyraster_xterm256, bench2) {
ttyraster_xterm256_setup();
EZBENCH(donothing, ttyraster2x2_xterm256());
}
BENCH(ttyraster_xterm256, bench6) {
ttyraster_xterm256_setup();
EZBENCH(donothing, ttyraster6x2_xterm256());
}
*/

130
test/dsp/tty/windex_test.c Normal file
View file

@ -0,0 +1,130 @@
/*-*- 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
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "dsp/tty/windex.h"
#include "libc/assert.h"
#include "libc/bits/bits.h"
#include "libc/limits.h"
#include "libc/macros.h"
#include "libc/nexgen32e/x86feature.h"
#include "libc/str/str.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/testlib.h"
unsigned windex$k8(short *, size_t) hidden;
unsigned windex$avx2(short *, size_t) hidden;
unsigned windex$sse4(short *, size_t) hidden;
const short kW[64] aligned(32) = {
8281, 3883, 1365, 1786, 9006, 3681, 5563, 8013, 5787, 9063, 2923,
3564, 6122, 32, 1436, 0741, 7957, 9219, 1320, 2083, 1904, 8905,
2465, 9122, 9563, 1290, 4474, 3988, 9920, 8325, 1088, 2915, 33,
1085, 7806, 3248, 1186, 1357, 6738, 1311, 1092, 6195, 7089, 6631,
1261, 1364, 9007, 8289, 1409, 1090, 8358, 1502, 7658, 2668, 3522,
1730, 2041, 7707, 5096, 6876, 1324, 1242, 5283, 0x7fff,
};
const short kW2[32] aligned(32) = {
8281, 1, 1365, 1786, 9006, 3681, 5563, 8013, 5787, 9063, 2923,
3564, 6122, 32, 1436, 0741, 7957, 9219, 1320, 2083, 1904, 8905,
2465, 9122, 9563, 1290, 4474, 3988, 9920, 8325, 1088, 2915,
};
const short kW3[64] aligned(32) = {
8281, 0x7fff, 1365, 1786, 9006, 3681, 5563, 8013, 5787, 9063, 2923,
3564, 6122, 32, 1436, 0741, 7957, 9219, 1320, 2083, 1904, 8905,
2465, 9122, 9563, 1290, 4474, 3988, 9920, 8325, 1088, 2915, 33,
1085, 7806, 3248, 1186, 1357, 6738, 1311, 1092, 6195, 7089, 6631,
1261, 1364, 9007, 8289, 1409, 1090, 8358, 1502, 7658, 2668, 3522,
1730, 2041, 7707, 5096, 6876, 1324, 1242, 7, 0x7fff,
};
#define TestIt(impl, index, value, n, array) \
({ \
short *a = memcpy(tgc(tmemalign(32, n * 2)), array, n * 2); \
unsigned res = impl(array, n); \
ASSERT_EQ(index, res); \
ASSERT_EQ(value, a[res]); \
})
TEST(windex, testRealWorldPicks) {
const short kPicks[96] aligned(32) = {
103, 85, 145, 146, 121, 103, 145, 187, 146, 189,
121, 103, 139, 121, 63, 105, 105, 147, 60, 103,
103, 146, 121, 103, 139, 121, 139, 121, 157, 139,
199, 200, 163, 223, 164, 225, 81, 141, 105, 165,
78, 139, 103, 164, 61, 103, 103, 145, 79, 139,
103, 163, 21, 63, 21, 81, 63, 45, 105, 106,
106, 107, 102, 103, 103, 104, 64, 107, 107, 150,
82, 143, 107, 168, 108, 109, 109, 110, 21, 64,
21, 82, 105, 106, 64, 46, 106, 107, 0x7fff, 0x7fff,
0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x7fff, 0x7fff,
};
/* multiple valid answers are fine if it's deterministic */
TestIt(windex$k8, 52, 21, ARRAYLEN(kPicks), kPicks);
if (X86_HAVE(AVX2)) TestIt(windex$avx2, 78, 21, ARRAYLEN(kPicks), kPicks);
if (X86_HAVE(SSE4_2)) TestIt(windex$sse4, 80, 21, ARRAYLEN(kPicks), kPicks);
}
TEST(windex, test) {
TestIt(windex, 13, 32, ARRAYLEN(kW), kW);
TestIt(windex, 1, 1, ARRAYLEN(kW2), kW2);
TestIt(windex, 62, 7, ARRAYLEN(kW3), kW3);
}
TEST(windex$avx2, test) {
if (X86_HAVE(AVX2)) {
TestIt(windex$avx2, 13, 32, ARRAYLEN(kW), kW);
TestIt(windex$avx2, 1, 1, ARRAYLEN(kW2), kW2);
TestIt(windex$avx2, 62, 7, ARRAYLEN(kW3), kW3);
}
}
TEST(windex$sse4, test) {
if (X86_HAVE(SSE4_2)) {
TestIt(windex$sse4, 13, 32, ARRAYLEN(kW), kW);
TestIt(windex$sse4, 1, 1, ARRAYLEN(kW2), kW2);
TestIt(windex$sse4, 62, 7, ARRAYLEN(kW3), kW3);
}
}
TEST(windex$k8, test) {
TestIt(windex$k8, 13, 32, ARRAYLEN(kW), kW);
TestIt(windex$k8, 1, 1, ARRAYLEN(kW2), kW2);
TestIt(windex$k8, 62, 7, ARRAYLEN(kW3), kW3);
}
////////////////////////////////////////////////////////////////////////////////
BENCH(windex, bench) {
EZBENCH(donothing, windex(kW, ARRAYLEN(kW)));
}
BENCH(windex$k8, bench) {
EZBENCH(donothing, windex$k8(kW, ARRAYLEN(kW)));
}
BENCH(windex$avx2, bench) {
if (X86_HAVE(AVX2)) {
EZBENCH(donothing, windex$avx2(kW, ARRAYLEN(kW)));
}
}
BENCH(windex$sse4, bench) {
if (X86_HAVE(SSE4_2)) {
EZBENCH(donothing, windex$sse4(kW, ARRAYLEN(kW)));
}
}