If mod(%) are so expensive why not make own modulus?

Правка en1, от Qualified, 2020-07-25 21:21:07

I see this article and at the bottom, it says that modulus operators are expensive so they implemented a slightly faster version of Euclidean Algorithm. Why not make a more efficient mod?

int mod(int a, int b) { // computes a % b;
	return (a - b * (a / b));
}

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский Qualified 2020-07-25 21:21:07 389 Initial revision (published)