This file contains 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
template <unsigned int n, unsigned int bit = 31> | |
struct mag | |
{ | |
enum { | |
lval = (n & (1UL << bit)) != 0 ? bit : 0, | |
rval = mag<n, bit - 1>::value, | |
value = lval > rval ? lval : rval // max | |
}; | |
}; |
This file contains 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
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! |
This file contains 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 "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, |
This file contains 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
#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]; |
This file contains 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 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) { |
This file contains 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
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"); |
This file contains 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> | |
#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')) |
This file contains 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 "clip.h" | |
#include <math.h> | |
#include <stdio.h> | |
void clip_polygon(polygon *in, polygon *out, Vector4 eq) | |
{ | |
int edge; | |
out->vertex_count = 0; |
This file contains 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 <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); |
This file contains 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 <math.h> | |
#define LUT_LOG2_SIZE 8 | |
#define LUT_SIZE ((1 << LUT_LOG2_SIZE) + 1) | |
float lut[LUT_SIZE]; | |
float convert(float f) | |
{ | |
union { |
OlderNewer