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
-- Compile and run with: | |
-- ghc Simplify.hs | |
-- ./Simplify | |
import Data.Bits | |
import Data.List | |
import Data.Maybe | |
import Data.Function | |
import System.Random | |
import Control.Monad | |
import Debug.Trace |
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
// g++ -std=c++17 ir.cpp -pedantic -Wall -Wextra -g -o ir | |
#include <type_traits> | |
#include <unordered_set> | |
#include <cassert> | |
#include <cstdint> | |
#include <iostream> | |
// Def is just exposing the data, nothing more | |
struct Def { | |
uint32_t gid; |
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 <memory> | |
#include <iostream> | |
#include <algorithm> | |
#include <climits> | |
#define SWAP(T, x, y) \ | |
{ \ | |
T z = x; \ | |
(x) = y; \ | |
(y) = z; \ |
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 <stdlib.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <stdbool.h> | |
#include <inttypes.h> | |
#include <limits.h> | |
#include <assert.h> | |
typedef struct op_s op_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
#include <stdint.h> | |
#include <inttypes.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
static inline uint64_t split(uint64_t x, int log_bits) { | |
uint64_t mask = (UINT64_C(1) << (1 << log_bits)) - 1; | |
for (int i = log_bits, n = 1 << log_bits; i > 0; --i, n >>= 1) { | |
mask = (mask | (mask << n)) & ~(mask << (n / 2)); | |
x = (x | (x << n)) & mask; |
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
" Lint .h files as C++, not C | |
let g:ale_pattern_options_enabled = 1 | |
let g:ale_pattern_options = { '\.h$': { 'ale_linters': { 'cpp' : ['cc', 'gcc', 'clang'] } } } | |
" Set flags for gcc/clang | |
let opts = '-std=c++17 -Wall -Wextra' | |
let g:ale_linters = { 'cpp': ['cc', 'gcc', 'clang'] } | |
let g:ale_cpp_cc_options = opts | |
let g:ale_cpp_gcc_options = opts | |
let g:ale_cpp_clang_options = opts |
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
// g++ bench_renderline.cpp -std=c++17 -O3 -march=native -o bench_renderline | |
// The benchmarked functions (RenderLine, ...) where taken from | |
// diasurgical/devilutionX | |
// Copyrights to their respective authors, license is "The Unlicense" | |
#include <cstdint> | |
#include <cstddef> | |
#include <cstring> | |
#include <climits> |
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 <stdint.h> | |
#include <stddef.h> | |
#include <stdbool.h> | |
#include <stdio.h> | |
#include <inttypes.h> | |
#include <assert.h> | |
#define REG_COUNT 64 | |
#define OPCODE_LIST(f) \ |
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
#!/bin/sh | |
# Disables notification sounds from gnome | |
dconf write /org/gnome/desktop/sound/event-sounds "false" | |
# Disables PulseAudio's suspend-on-idle to avoid cracks and pops | |
echo " | |
.include /etc/pulse/default.pa | |
.nofail | |
unload-module module-suspend-on-idle |
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 <tgmath.h> | |
#include <stddef.h> | |
#include <stdbool.h> | |
#include <stdint.h> | |
#include <inttypes.h> | |
#include <string.h> | |
#include <stdio.h> | |
// Discrete probability distribution sampling according to the method named | |
// "Squared Histogram" in "Fast Generation of Discrete Random Variables", |