Get the latest tech news

Optimizing 128-bit Division (2020)


When it comes to hashing, sometimes 64 bit is not enough, for example, because of birthday paradox — the hacker can iterate through random $latex 2^{32}$ entities and it can be proven that wi…

https://godbolt.org/z/o2vTZr In reality everything is slightly better because of pipeline execution and division has its own ALU, so if you divide something and do something else in the next instructions, you will get lower average latency. The algorithm is easy, we align the numbers by their most significant bits, if dividend is more than divisor, subtract and add 1 to the output, then shift by 1 and repeat. Libdivide is a small library targeting fast division, for example, if you divide by some fixed number a lot of times, there are techniques that can precalculate reciprocal and then multiply by it.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of division

division

Photo of bit Division

bit Division

Related news:

News photo

Ubisoft's planned free-to-play Division game is dead

News photo

BuzzFeed Cuts 16% of Staff, Sells Division for $108.6 Million

News photo

The Division: Heartland has been rated in Taiwan, hinting that a release could be imminent