|
unsigned int remainder10(unsigned int x) /* assuming 16-bit integers */
{
static unsigned int const tbl[] =
{ 40960u, 20480, 10240, 5120, 2560, 1280,
640, 320, 160, 80, 40, 20, 10 };
int i;
for (i=0; i < sizeof(tbl)/sizeof(tbl[0]); i++) {
if ( x > tbl[i] ) {
x -= tbl[i];
}
}
return x;
}
E-mail: info@telesys.ru