Skip to content

Instantly share code, notes, and snippets.

#define Minimum(A,B) ((A) < (B) ? (A) : (B))
static void
MergeSort(int *A, int Count, int *S)
{
// A is the array to sort.
// S should be a buffer of at least the same size as A, doesn't have to be initialized.
for (int i = 0; i+1 < Count; i+=2)
{
if (A[i] > A[i+1])
@ganbatte8
ganbatte8 / xcb_demo.c
Last active June 10, 2023 16:31
Simple game loop in Linux/XCB, writing pixels with CPU, enforcing a framerate, reading joystick, keyboard and mouse input.
// Linking: -lxcb -lxcb-image
//#include <xcb/xcb.h>
#include <xcb/xcb_image.h>
#include <malloc.h>
#include <unistd.h>
#include <fcntl.h>
#include <linux/joystick.h>
//#include <time.h>
#include <sys/stat.h>