Skip to content

Instantly share code, notes, and snippets.

View kusma's full-sized avatar

Erik Faye-Lund kusma

View GitHub Profile
#include <stdio.h>
void foo(signed int v)
{
printf("signed int: %x\n", v);
}
void foo(unsigned int v)
{
printf("unsigned int: %x\n", v);
@kusma
kusma / srgb-lut.c
Created November 6, 2012 01:41
Attempt on branch-free sRGB conversion by LUT without excessive range
#include <stdio.h>
#include <math.h>
#define LUT_LOG2_SIZE 8
#define LUT_SIZE ((1 << LUT_LOG2_SIZE) + 1)
float lut[LUT_SIZE];
float convert(float f)
{
union {
#include <stdio.h>
#include <stdint.h>
#include <mint/falcon.h>
unsigned char buf[320 * 200];
int main(int argc, char *argv[])
{
void *logbase = Logbase(), *physbase = Physbase();
uint16_t old_mode = VsetMode(-1);
@kusma
kusma / clip.c
Last active February 19, 2016 01:57
#include "clip.h"
#include <math.h>
#include <stdio.h>
void clip_polygon(polygon *in, polygon *out, Vector4 eq)
{
int edge;
out->vertex_count = 0;
#include <stdio.h>
#define MAG 3
#define SIZE (1 << MAG)
const int seed[2][2] = {{0, 2}, {3, 1}};
int main()
{
int x, y;
for (y = 0; y < SIZE; ++y, putchar('\n'))
DWORD SetThreadExecutionState(DWORD flags)
{
typedef DWORD (WINAPI *T)(DWORD);
static T SetThreadExecutionState = NULL;
static int first = 1;
if (first) {
first = 0;
SetThreadExecutionState = (T)GetProcAddress(
GetModuleHandle("KERNEL32.DLL"), "SetThreadExecutionState");
static DWORD GetProcessId(HANDLE hProcess)
{
typedef DWORD (WINAPI *pfnGPI)(HANDLE);
typedef ULONG (WINAPI *pfnNTQIP)(HANDLE, ULONG, PVOID, ULONG, PULONG);
static int first = 1;
static pfnGPI GetProcessId;
static pfnNTQIP ZwQueryInformationProcess;
if (first) {
#ifdef USE_ASM
#ifdef ARM
inline __attribute__((const))
unsigned int
clz_iasm(unsigned int num)
{
unsigned int ret, tmp;
const unsigned char *lut = &math::clz8_lut[0];
#include "math.h"
const
unsigned char
math::clz_lut[256] =
{
8,7,6,6,5,5,5,5,4,4,4,4,4,4,4,4,
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
THE FLIPCODE "TEAM WANTED" FORM, VERSION 1.0
HELLO my name is __________________. I am looking for new members to fill out my team.
I'm designing a revolutionary new
[ ] MMORPG
[ ] FPS
[ ] RPG
that will change the world forever!