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> // ./rast > test.ppm | |
#include<stdlib.h> // fgiesen.wordpress.com/2013/02/17/optimizing-sw-occlusion-culling-index/ | |
#include<string.h> | |
#define W 800 | |
#define H 600 | |
#define X(a,b) (a)>(b)?(a):(b) | |
#define X3(a,b,c) X(X(a,b),(c)) | |
#define N(a,b) (a)<(b)?(a):(b) | |
#define N3(a,b,c) N(N(a,b),(c)) | |
typedef float f;typedef int i;char b[W*H]={};struct F{f x,y,z;};struct I |
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 "perf_monster.h" | |
#include "example.h" | |
enum example_events | |
{ | |
MARK_A, | |
MARK_B, | |
MARK_C, | |
MARK_D |
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 <assert.h> | |
#include <stddef.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <time.h> | |
#include <math.h> | |
#ifndef M_PI |
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
enum tn_block_type | |
{ | |
// This block is full of nothing! | |
TN_BLOCK_EMPTY, | |
// This block is full of its material. Chockers even! | |
TN_BLOCK_SOLID, | |
// Only the floor part (lowest 10th) filled with material. Walkable surface. | |
TN_BLOCK_FLOOR, |
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
// 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 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
var Interval = function(lower, upper) { | |
this.lower = lower; | |
this.upper = upper; | |
} | |
function interval_add(a, b) { | |
return new Interval(a.lower + b.lower, a.upper + b.upper); | |
} |
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
SYSTEM SPECS | |
============ | |
i7 2600k | |
Radeon HD 7970 GHz Edition | |
8GB DDR3 | |
Plenty fast enough to run all these games smoothly on their highest settings in windows. | |
linux 3.7.5 |
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
// Playing around with what's necessary to implement a semaphore on top of Linux | |
// futexes. | |
static inline int my_sem_wait(struct semaphore *sem) | |
{ | |
int new = __sync_sub_and_fetch(&sem->value, 1); | |
if(new < 0) | |
{ | |
// This incorrectly handles the failure case where value is no longer | |
// new when the call executes. Not sure how to fix. | |
// If the new value is >= 0 then we've missed a wakeup |
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
// None of these include GL.h or anything like them. This is left to the user | |
// since there are myriad options. Also makes auto-generating LuaJIT FFI | |
// bindings roughly 9000 times easier. | |
#include <sgl/sgl.h> | |
#include <sgl/window.h> | |
#include <sgl/event.h> | |
// Windows, GL Contexts and Event handling is all the features we will ever | |
// have. Not going to add threading, image loading, timing or any other | |
// fluff like that. I'd like to ditch input even, but that's a bit tricky |
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 <pthread.h> | |
#include <stdio.h> | |
#define PRODUCER_COUNT 4 | |
#define CONSUMER_COUNT 4 | |
#define THREAD_COUNT (PRODUCER_COUNT + CONSUMER_COUNT) | |
#define WORK_ITERS 10000 | |
#define WORK_COUNT 10000 | |
#define QUEUE_SIZE 64 |