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
| // Ref: https://old.reddit.com/r/C_Programming/comments/1pxat1v | |
| #include <assert.h> | |
| #include <stdarg.h> | |
| #include <stdint.h> | |
| #include <stdio.h> | |
| #include <string.h> | |
| #define new(a, n, t) (t *)alloc(a, n, sizeof(t), _Alignof(t)) | |
| typedef struct Dtor Dtor; |
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
| // $ eval cc -g3 -o demo demo.c $(pkg-config --cflags --libs sdl2) | |
| // Ref: https://old.reddit.com/r/C_Programming/comments/1prwizy | |
| // Ref: https://github.com/Avery-Personal/Jubi | |
| #define JUBI_IMPLEMENTATION | |
| #include "Jubi.h" | |
| #include "SDL.h" | |
| static Sint32 randn(Uint64 *s, Sint32 lo, Sint32 hi) | |
| { | |
| *s = *s*0x3243f6a8885a308d + 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
| // https://old.reddit.com/r/C_Programming/comments/1pr881z/ | |
| // $ cc -std=gnu23 -O -o baseline baseline.c | |
| #include <assert.h> | |
| #include <stddef.h> | |
| #include <stdint.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <unistd.h> |
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
| // https://old.reddit.com/r/C_Programming/comments/1pnh9fq | |
| #include <assert.h> | |
| #include <stddef.h> | |
| #include <stdint.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #define S(s) (Str){s, sizeof(s)-1} | |
| #define new(a, n, t) (t *)alloc(a, n, sizeof(t), _Alignof(t)) |
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
| .section .exebuf,"bwx" | |
| .globl exebuf | |
| exebuf: .space 1<<21 |
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
| .section .exebuf,"bwx" | |
| .globl exebuf | |
| exebuf: .space 1<<12 |
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
| // Ref: https://old.reddit.com/r/C_Programming/comments/1oqxeeq | |
| // This is free and unencumbered software released into the public domain. | |
| #include <math.h> | |
| #include <stdio.h> | |
| #define lenof(a) (int)(sizeof(a) / sizeof(*(a))) | |
| typedef struct { float x, y; } V2; | |
| typedef struct { float x, y, z; } V3; |
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
| ; Assemble: | |
| ; $ nasm -fwin32 cube.asm | |
| ; Link with Mingw-w64: | |
| ; $ cc -mwindows -o cube.exe cube.obj libglfw3.a -lglu32 -lopengl32 | |
| ; Link with MSVC: | |
| ; $ link /subsystem:windows cube.obj glfw3.lib opengl32.lib glu32.lib user32.lib gdi32.lib shell32.lib | |
| ; | |
| ; This is free and unencumbered software released into the public domain. | |
| bits 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
| // Assumes input is a 1080x1527 PPM with minimal header named maze.ppm. | |
| // Outputs output.ppm with the solution drawn on top, and maze.txt with | |
| // the raw maze structure. | |
| // | |
| // This is free and unencumbered software released into the public domain. | |
| #include <math.h> | |
| #include <stdint.h> | |
| #include <stdio.h> | |
| #include <string.h> |
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
| ALL = skeetocrt.dll skeetocrt.dll.a crt0.o | |
| all: $(ALL) | |
| skeetocrt.dll skeetocrt.dll.a: skeetocrt.c stdio.h | |
| cc -shared -g3 -fno-builtin -nostartfiles --entry=0 \ | |
| -Wl,--out-implib=skeetocrt.dll.a -o skeetocrt.dll skeetocrt.c | |
| crt0.o: crt0.c stdio.h | |
| cc -c -g3 -fno-builtin -nostdlib -nostdinc -isystem . -o crt0.o crt0.c |
NewerOlder