Skip to content

Instantly share code, notes, and snippets.

@jbedo
jbedo / hilbert.c
Created November 30, 2011 01:08
Matrix multiplication with Hilbert space-filling curves
#include<u.h>
#include<libc.h>
#define MAX(a, b) ((a) > (b) ? (a) : (b))
/* Hilbert curve functions (from Wikipedia) */
/* rotate/flip a quadrant appropriately */
void rot(int n, int *x, int *y, int rx, int ry)
{