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 like this: | |
// cl Win32.c /O1 /c /GS- && crinkler Win32.obj user32.lib kernel32.lib gdi32.lib /SUBSYSTEM:WINDOWS /NODEFAULTLIB /UNSAFEIMPORT /TINYHEADER | |
#include <windows.h> | |
#define WN_TITLE "Unnamed" | |
#define WN_CLASS "WindowClassName" | |
#define WN_WIDTH 800 | |
#define WN_HEIGHT 600 |
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 { | |
float x, y, z; | |
} vector3; | |
// Implementation defined, in OpenGL it would probably push the vertices into | |
// vertex buffer and add indices to the index buffer. | |
void make_tri(vector3 p1, vector3 p2, vector3 p3); | |
int main() { | |
#define SEGMENTS 9 |
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
// clang-format off | |
// Compile the program linking user32.lib | |
#pragma comment(lib, "user32.lib") | |
#include <Windows.h> | |
// Event handler. | |
LRESULT CALLBACK WndProc( | |
HWND hWnd, // Window the event was assigned to. | |
UINT Msg, // Message type. |
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 <stdint.h> | |
#include <stdbool.h> | |
#include <stdlib.h> | |
#define ADDR_MODE_COUNT 13 | |
enum instr { | |
ADC, AND, ASL, | |
BCC, BCS, BEQ, BIT, BMI, BNE, BPL, BRK, BVC, BVS, |
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> | |
#include <math.h> | |
#define NUM_SAMPLES 44100 | |
#define PI 3.14159265 | |
// ------ NOTE IDS ------ | |
#define C_ 0 | |
#define CS 1 | |
#define D_ 2 |
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 <stdlib.h> | |
#include "../../lib/umka/src/umka_api.h" | |
#include <string.h> | |
#ifdef __unix__ | |
#include <dirent.h> | |
// 0 : DirectoryPath : str | |
// R : DirPtr : ^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
// DOES NOT WORK ON NEGATIVE VALUES !! :P | |
#include <stdio.h> | |
union MyFloat { | |
float fv; | |
struct { | |
unsigned mantissa: 23; | |
unsigned exponent: 8; | |
unsigned sign: 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 <emmintrin.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <stdbool.h> | |
#include <immintrin.h> | |
#include <time.h> | |
#define Benchmark(name, times) for (int t = 1; t;) for (double final; t;) for(clock_t start = clock(); t; final = (double)(clock()-start) / CLOCKS_PER_SEC, printf(" <%s> %gs / %dtimes = %gs\n", name, final, times, final/times), t = 0) for (int i = 0; i < times; ++i) | |
#define Utf8_BYTES_PER_ASCII 32 |
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
static inline size_t Utf8_Fetch(uint32_t *out, const char *s_) | |
{ | |
const unsigned char *s = (const unsigned char*)s_; | |
if ((*s & 0xC0) != 0xC0) { | |
*out = *s; | |
return *s > 0; | |
} | |
const static size_t clas[32] = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,2,2,2,2,3,3,4,5}; | |
size_t cl = clas[*s>>3]; |
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
set background=dark | |
hi clear | |
if exists("syntax_on") | |
syntax reset | |
endif | |
let colors_name = "handmade-hero" |
NewerOlder