mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 06:48:31 +00:00
Strengthen the pledge() polyfill
This commit is contained in:
parent
a6f65eea7c
commit
3c92adfd6e
79 changed files with 1457 additions and 357 deletions
|
@ -17,9 +17,14 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/bits/bits.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/testlib/ezbench.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
pledge("stdio rpath", 0);
|
||||
}
|
||||
|
||||
unsigned P[] = {
|
||||
// 33333222222222111111111000000000
|
||||
0b000011000000010000000001000000000, //
|
||||
|
@ -106,7 +111,5 @@ TEST(bextra, 9bit) {
|
|||
}
|
||||
|
||||
BENCH(bextra, bench) {
|
||||
EZBENCH2("bextra 0/32", donothing, bextra(P, 0, 32));
|
||||
EZBENCH2("bextra 1/31", donothing, bextra(P, 1, 31));
|
||||
EZBENCH2("bextra 1/32", donothing, bextra(P, 1, 32));
|
||||
}
|
||||
|
|
|
@ -17,9 +17,14 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/bits/bits.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/testlib/ezbench.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
pledge("stdio rpath", 0);
|
||||
}
|
||||
|
||||
TEST(bitreverse, test) {
|
||||
EXPECT_EQ(0xde, BITREVERSE8(123));
|
||||
EXPECT_EQ(0xde, bitreverse8(123));
|
||||
|
|
|
@ -18,12 +18,17 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/bits/bits.h"
|
||||
#include "libc/bits/popcnt.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/runtime/gc.internal.h"
|
||||
#include "libc/testlib/ezbench.h"
|
||||
#include "libc/testlib/hyperion.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
pledge("stdio rpath", 0);
|
||||
}
|
||||
|
||||
TEST(_countbits, testLow) {
|
||||
int i;
|
||||
char p[2];
|
||||
|
|
|
@ -17,11 +17,16 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/bits/morton.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/nexgen32e/kcpuids.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "libc/testlib/ezbench.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
pledge("stdio rpath", 0);
|
||||
}
|
||||
|
||||
TEST(morton, test) {
|
||||
EXPECT_EQ(0, morton(0, 0));
|
||||
EXPECT_EQ(1, morton(0, 1));
|
||||
|
|
|
@ -24,11 +24,13 @@ TEST_LIBC_BITS_CHECKS = \
|
|||
|
||||
TEST_LIBC_BITS_DIRECTDEPS = \
|
||||
LIBC_BITS \
|
||||
LIBC_FMT \
|
||||
LIBC_INTRIN \
|
||||
LIBC_MEM \
|
||||
LIBC_RUNTIME \
|
||||
LIBC_NEXGEN32E \
|
||||
LIBC_RUNTIME \
|
||||
LIBC_STUBS \
|
||||
LIBC_SYSV \
|
||||
LIBC_TESTLIB \
|
||||
LIBC_X \
|
||||
THIRD_PARTY_COMPILER_RT
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue