Y
Hacker News
new
|
ask
|
show
|
jobs
by
brundolf
2066 days ago
Did I miss something? I got to the end and still don't know what -n % n actually accomplishes in practice, nor why it's mainly used in high-performance code
1 comments
edflsafoiewq
2066 days ago
It computes (2^b) % n, assuming n is an unsigned b-bit integer. You can't do this directly, since 2^b itself doesn't fit into a b-bit integer.
link