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 <stdlib.h> | |
#include <stdint.h> | |
#include <assert.h> | |
#include <string.h> | |
#define streq(a, b) (!strcmp((a), (b))) | |
#ifndef __USE_GNU | |
#define __USE_GNU | |
#endif |
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 <stdint.h> | |
#include <assert.h> | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
#include <sys/mman.h> | |
#include <fcntl.h> | |
#include <unistd.h> |
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 <assert.h> | |
#include <stddef.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
#define tag(x) ((ptrdiff_t)&Tag##x) | |
#define is(x, T) ((x)->tag == tag(T)) | |
#define as(x, T) ((struct T *)variant_cast((void *)(x), tag(T))) | |
static inline void* |
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
struct quat | |
quat_from_two_vectors(vec3 u, vec3 v) | |
{ | |
float m = sqrt(2.f + 2.f * dot(u, v)); | |
vec3 w = (1.f / m) * cross(u, v); | |
return quat(0.5f * m, w.x, w.y, w.z); | |
} |
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
static void | |
Quat_FromEulerXYZ(float *euler_quat, float x, float y, float z) | |
{ | |
float sx = (float)sin((double)(x * 0.5f)); | |
float sy = (float)sin((double)(y * 0.5f)); | |
float sz = (float)sin((double)(z * 0.5f)); | |
float cx = (float)cos((double)(x * 0.5f)); | |
float cy = (float)cos((double)(y * 0.5f)); | |
float cz = (float)cos((double)(z * 0.5f)); |
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 <stdlib.h> | |
#include <string.h> | |
#include <assert.h> | |
#include <limits.h> | |
#include <sys/time.h> | |
#include <unistd.h> | |
#include <time.h> |
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
#define LIB_DEBUG 2 | |
#if defined(LIB_DEBUG) && (LIB_DEBUG >= 2) | |
#include <stdio.h> | |
#define DEBUG_LOG(l, ...) \ | |
if (l <= LIB_DEBUG) { \ | |
fprintf(stderr, "%s(L:%d):, __FILE__, __LINE__); \ | |
fprintf(stderr, __VA_ARGS__); \ | |
fprintf(stderr, " \n"); \ | |
} | |
#else |
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
#if 0 | |
static void | |
usage(const char *app) | |
{ | |
panic("\n" | |
"usage: %s [options]\n" | |
"\n" | |
" options:\n" | |
"\n" |
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
struct path_iter { | |
const char *begin; | |
const char *end; | |
/* internal */ | |
const char *next; | |
const char *eof; | |
}; | |
static void | |
path_begin(struct path_iter *it, const char *str, const char *end) | |
{ |
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 <stdarg.h> | |
#include <string.h> | |
#include <stdint.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
#include <limits.h> | |
/* --------------------------------------------------------------------------- | |
* ARG |
OlderNewer