13 lines
249 B
C
13 lines
249 B
C
|
#include <stdlib.h>
|
||
|
|
||
|
div_t div(int num, int denom)
|
||
|
{
|
||
|
/*
|
||
|
** On SuperH, division and modulus are both very slow, so it's more
|
||
|
** efficient to perform only one division.
|
||
|
*/
|
||
|
int q = num / denom;
|
||
|
int r = num - q * denom;
|
||
|
return (div_t){ q, r };
|
||
|
}
|