Ein Blog

On finding the average of two unsigned integers without overflow.

Enthält auch eine (ehemalig) patentierte Variante.

Gut gefällt mir auch der untere Part:

Bonus chatter: C++20 adds a std::midpoint function that calculates the average of two values (rounding toward a).
Bonus viewing: std::midpoint? How hard could it be? (Vortrag geht eine Stunde)