Last active
July 25, 2017 08:45
-
-
Save realmonster/3abdbf5406b878e6a0f9a53abc7ed895 to your computer and use it in GitHub Desktop.
Get remainder by 320 for old CPU
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 <cstdio> | |
typedef unsigned short u16; | |
unsigned char table[1<<10]; | |
void prepare() | |
{ | |
for (int i=0; i<(1<<10); ++i) | |
table[i] = ((i%5)<<5); | |
} | |
u16 rem320(u16 a) | |
{ | |
return (table[a>>6]*2) | (a & 0x3F); | |
} | |
int main() | |
{ | |
prepare(); | |
for (int i=0; i<(1<<16); ++i) | |
{ | |
if ((i%320) != (int)rem320(i)) | |
{ | |
printf("%d\n", i); | |
} | |
} | |
printf("end"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment