This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
{ base64 -d | tar xJf - && make >/dev/null && ./stringy_prime "$@"; } << EOF | |
/Td6WFoAAATm1rRGAgAhAQwAAACPmEGc4Hf/E3hdACaYSWZp2dmN5MBFtReU64IZsyM5tnRakSFu | |
UPbdIR/QuF5EFRUUhH/5HwelTiMRTMQTMB8haLGg9CMnIdukTtlgXKTJM/Kd0AxEruxtr46KoLCE | |
5wH2u0auKErz8PuO5Sohr/jU5hsMknDSkidKBpsGJPDBc0JRlAJaJ1w2Yvn75B8bpsgQvr+vPFR4 | |
98UB7klgs9DC4xH4PakHpWzf7Oj8YqPgZDnqj+mqcWPQ6dhdjsbkbQw+SUZRRN5EpBKyVa2q4QJs | |
4o9u+lIkKVTDrFwnLqgMoHogm/VKoolkGLBFD1gyNxNdxMU6M1PX8Ja6m/JVu/xhQFMAuKWAe1p7 | |
79K1RWjGJLTnJCXLHvxxn33La80M6RAPZf0hPo93iTz8Lhu5NsP0bfe1QgX3WqXB70f5TMt8nZSN | |
UYmb+8HtRCjMv/xBowOuxcYHY2oeUuHb2+lavETFfeqc/7wuFwMBUwhrkCf++AC0k6oBgbcte5X4 | |
Th79/TqLq+NYm/7sEobxti/sqRvtI6onS3CyiJeBdFUDEBJ22zkZ/B65PagiVkkgCnbXeal21NWb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <limits.h> | |
#include <stddef.h> | |
#include <stdint.h> | |
#define popcnt(x) (size_t)({\ | |
typeof (_Generic(x, \ | |
int32_t: (uint32_t)1, \ | |
int64_t: (uint64_t)1, \ | |
uint32_t: (uint32_t)1, \ | |
uint64_t: (uint64_t)1))y=x; \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Compile with "gcc -std=c23 -mbmi2 -mlzcnt" (gcc-14) | |
* or "gcc -std=c2x -mbmi2 -mlzcnt" (gcc-13) | |
*/ | |
#include <errno.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <immintrin.h> | |
static void | |
bitpr (uint64_t n) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Behavior of gcc-14 and clang-19 diverge on this. | |
// Compile with -std=gnu23. | |
#include <stdio.h> | |
int main(void) { | |
printf("%s\n", _Generic( | |
(struct{_BitInt(8) x : 2;}){}.x, | |
_BitInt(2): "gcc", _BitInt(8): "clang")); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define typeof_unqual(x) __typeof__(((void)1, *(__typeof__(x) *)(void *)0)) | |
int main(void) { | |
const int ci = 1; | |
typeof_unqual(ci) i1 = ci; | |
typeof_unqual(const int) i2 = ci; | |
i1 = 0; | |
i2 = 0; | |
return i1 + i2; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <inttypes.h> | |
#include <limits.h> | |
#include <stdbool.h> | |
#include <stddef.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#define force_inline __attribute__((always_inline)) inline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override BIN := test | |
override SRC := test.c msg.c | |
override OBJ := $(SRC:%=%.o) | |
override DEP := $(SRC:%=%.d) | |
CFLAGS := -O2 -march=native -mtune=native -flto | |
$(BIN): $(OBJ) | |
$(CC) $(CFLAGS) -o $@ $^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* SPDX-License-Identifier: GPL-2.0-or-later */ | |
/** @file dstr.c | |
* | |
* @author Juuso Alasuutari | |
*/ | |
#include <errno.h> | |
#include "dstr.h" | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
e e e e e | |
e m a n a t e m e t a n a m e | |
a a a a a | |
n n n n n | |
a a a a a | |
t t t t t | |
e e e e e | |
e m a n a t e m e t a n a m e | |
e e e e e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# IMPORTANT: The HTTP authorization header must be found | |
# in ~/.openai in full, not just the API key. | |
# | |
# Usage: ./documentarist.sh /path/file.c "my_function()" | |
# | |
# Requirements: dos2unix, cpp, clang-format, jq, curl | |
# |
NewerOlder