This file contains hidden or 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 \ | |
[ -n "${PATHEXT}" ] && ext='.exe'; \ | |
bin="$(dirname $0)/$(basename ${0%.*})$ext"; \ | |
c++ -std=c++14 -Werror -o $bin $0 \ | |
&& $bin "$@"; \ | |
status=$?; \ | |
rm $bin; \ | |
exit $status | |
#include <cstdio> |
This file contains hidden or 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 <stdio.h> | |
#define CONCAT(A, B) _CONCAT(A, B) | |
#define _CONCAT(A, B) A##B | |
#define TOSTRING(...) _TOSTRING(__VA_ARGS__) | |
#define _TOSTRING(...) #__VA_ARGS__ | |
#ifdef SECTION_DEFINITIONS | |
#define _section_declaration_definition(SECTION) section_definition(SECTION) |
This file contains hidden or 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
//Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x64 | |
#include <stdio.h> | |
#define CONCAT(A, B) _CONCAT(A, B) | |
#define _CONCAT(A, B) A##B | |
#define TOSTRING(...) _TOSTRING(__VA_ARGS__) | |
#define _TOSTRING(...) #__VA_ARGS__ |
This file contains hidden or 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
#pragma once | |
#include <assert.h> | |
#include <limits.h> | |
#include <stdbool.h> | |
#include <stddef.h> | |
#include <stdint.h> | |
//------------------------------------------------------------------------------ | |
typedef uint64_t bitset_block_t; |
This file contains hidden or 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
/* | |
c++ --version; c++ -std=c++14 -g stlcost.cpp && ./a.out && rm ./a.out | |
Apple LLVM version 10.0.1 (clang-1001.0.46.4) | |
Target: x86_64-apple-darwin18.6.0 | |
Thread model: posix | |
InstalledDir: /Library/Developer/CommandLineTools/usr/bin | |
iteration 0 ----------------------------------------- | |
malloc(): |
This file contains hidden or 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 swap(a, b) do {\ | |
typedef struct { char data[sizeof(a) == sizeof(b) ? sizeof(a) : -1]; } swap;\ | |
swap* const aa = (swap*)&(a);\ | |
swap* const bb = (swap*)&(b);\ | |
swap const cc = *aa; *aa = *bb; *bb = cc;\ | |
} while(0) |
This file contains hidden or 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
#pragma once | |
//------------------------------------------------------------------------------ | |
#define FNV1A32_BASIS (2166136261u) | |
#define FNV1A32_PRIME (16777619u) | |
#define FNV1A64_BASIS (14695981039346656037ull) | |
#define FNV1A64_PRIME (1099511628211ull) |
This file contains hidden or 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
#pragma once | |
#include <assert.h> | |
#define must_be_array(a)\ | |
_Pragma("GCC diagnostic push")\ | |
_Pragma("GCC diagnostic error \"-Wincompatible-pointer-types\"")\ | |
((void)sizeof(((char(*)(typeof(a[0])(*)[sizeof(a)/sizeof(a[0])]))0)(&a)))\ | |
_Pragma("GCC diagnostic pop")\ | |
// returns the length of the provided array |
This file contains hidden or 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
#pragma once | |
#ifdef __cplusplus | |
#include <cstdio> | |
static inline int | |
_echo(const char* x, bool v) | |
{ return printf("%s: %s", x, v?"true":"false"); } |
This file contains hidden or 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
#pragma once | |
#include <assert.h> | |
#include <stdbool.h> | |
#include <stddef.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <string.h> | |
#if defined(_WIN32) | |
#include <malloc.h> |