Make more improvements

This change includes many bug fixes, for the NT polyfills, strings,
memory, boot, and math libraries which were discovered by adding more
tools for recreational programming, such as PC emulation. Lemon has also
been vendored because it works so well at parsing languages.
This commit is contained in:
Justine Tunney 2020-09-28 01:13:56 -07:00
parent 416fd86676
commit 23d333c090
201 changed files with 14558 additions and 3082 deletions

View file

@ -29,6 +29,7 @@
#include "libc/bits/safemacros.h"
#include "libc/conv/itoa.h"
#include "libc/errno.h"
#include "libc/escape/escape.h"
#include "libc/fmt/fmt.h"
#include "libc/limits.h"
#include "libc/math.h"
@ -671,6 +672,12 @@ TEST(snprintf, twosBaneWithTypePromotion) {
EXPECT_STREQ("-32768", Format("%hd", x));
}
TEST(snprintf, formatStringLiteral) {
EXPECT_EQ('\\' | 'n' << 8, cescapec('\n'));
EXPECT_EQ('\\' | '3' << 8 | '7' << 16 | '7' << 24, cescapec('\377'));
EXPECT_STREQ("\"hi\\n\"", Format("%`'s", "hi\n"));
}
BENCH(palandprintf, bench) {
EZBENCH2("snprintf %x", donothing, Format("%x", VEIL("r", INT_MIN)));
EZBENCH2("snprintf %d", donothing, Format("%d", VEIL("r", INT_MIN)));