#include <stdio.h> #include <stdlib.h> typedef unsigned long long U64; typedef unsigned short gtype; void init_leap_table(int bits, U64 *atab, U64 *btab, gtype *gtab, U64 *thresh) { int i; for (i=0; i< (1<<bits); i++) { int a = (1<<bits); int b = i; int g = 0; while((a&1)==0) { if (b&1) //odd { a = 3*a; b = 3*b + 1; g++; } a /= 2; b /= 2; g++; } atab[i] = a; btab[i] = b; gtab[i] = g; thresh[i] = (0xffffffffffffffffLL-b)/a; } }