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 <time.h> | |
#include <assert.h> | |
#include <string.h> | |
#include <limits.h> | |
#include <inttypes.h> | |
uint32_t fnv1(const char *str) |
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 <time.h> | |
#include <assert.h> | |
#include <string.h> | |
#include <limits.h> | |
#include <inttypes.h> | |
uint32_t fnv1(const char *str) |
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 <time.h> | |
#include <assert.h> | |
#include <string.h> | |
#include <limits.h> | |
#include <inttypes.h> | |
uint32_t fnv1(const char *str) |
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
uint64_t rdtsc() | |
{ | |
uint64_t ret; | |
asm volatile ("rdtsc" : "=A"(ret)); | |
return ret; | |
} |
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> | |
#include <stdlib.h> | |
int modular_pow(int base, int exponent, int modulus) | |
{ | |
if(modulus == 1) return 0; | |
int result = 1; | |
base %= modulus; | |
while(exponent > 0){ | |
if(exponent & 1){ |
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 <assert.h> | |
#include <string.h> | |
#include <time.h> | |
#include "arr.h" | |
arr_int func(void) | |
{ |
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
#ifndef ARR_H | |
#define ARR_H | |
#ifndef assert | |
#define assert() | |
#endif | |
#define arr_alloc malloc | |
#define arr_calloc(a,b) arr_alloc((a) * (b)) |
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
int mesh_to_obbs(const mesh *me, struct vec3 (*boxes)[5], int *set_) | |
{ | |
int i, j, k, l; | |
int *set = set_; | |
int nset = 0; | |
if(!set){ | |
set = calloc(me->num_subs, sizeof(*set)); | |
memset(set, 0, me->num_subs * sizeof(*set)); | |
} |
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
float time_s_max = -FLT_MAX, time_e_min = FLT_MAX; | |
//[...] | |
for(i = 0; i < 4 + 3 * tri->num_verts; i++){ | |
float box_min, box_max, tri_min, tri_max; | |
//contact interval: time of first and last contact | |
float time_s, time_e; | |
//speed of box on axis | |
float dot = vec3_dot(axes[i], move); |
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
typedef struct vec2 | |
{ | |
fixed x, y; | |
} vec2; | |
typedef struct s_rayquery | |
{ | |
BITMAP *map; | |
vec2 start; | |
vec2 end; |