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 <stdio.h> | |
#include <assert.h> | |
int main(int argc, char** argv) { | |
assert(argc == 2); | |
char* fn = argv[1]; | |
FILE* f = fopen(fn, "r"); | |
printf("char a[] = {\n"); | |
unsigned long n = 0; | |
while(!feof(f)) { |
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
// We don't block multiple includes of this file since each inclusion should | |
// be for a different type. Be careful. | |
// | |
// A map using hopscotch hashing[1], an open-addressing scheme for resolving | |
// hash collisions. | |
// | |
// [1] Herlihy, Maurice and Shavit, Nir and Tzafrir, Moran (2008). | |
// "Hopscotch Hashing". | |
// DISC '08: Proceedings of the 22nd international symposium on |
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
#pragma once | |
#include <stdint.h> | |
//fnv1a 32 and 64 bit hash functions | |
// key is the data to hash, len is the size of the data (or how much of it to hash against) | |
// code license: public domain or equivalent | |
// post: https://notes.underscorediscovery.com/constexpr-fnv1a/ | |
inline const uint32_t hash_32_fnv1a(const void* key, const uint32_t len) { |
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 <stdio.h> | |
#include <assert.h> | |
int main(int argc, char** argv) { | |
assert(argc == 2); | |
char* fn = argv[1]; | |
FILE* f = fopen(fn, "r"); | |
printf("char a[] = {\n"); | |
unsigned long n = 0; | |
while(!feof(f)) { |
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
int parse_int(const char *str, bool *overflow) { | |
int pos = 1; | |
if (*str == '-') { | |
pos = 0; | |
str++; | |
} | |
int num = 0; | |
*overflow = false; | |
while (isdigit(*str)) { | |
int d = *str - '0'; |
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
uniform int n_lin_segments; | |
uniform vec2 lin_segments[256]; | |
uniform int n_quad_segments; | |
uniform vec2 quad_segments[512]; | |
varying vec3 pos; | |
varying vec2 uv; | |
void main() { | |
vec2 point = uv; | |
// point = (point + vec2(0.3, 0)) * 0.1; |