I saw the title and thought to just do "(a / 2) + (b / 2)" and a do a little bit of fudging if a or b is odd. After reading the article, learning that unsigned average(unsigned a, unsigned b) { return (a / 2) + (b / 2) + (a & b & 1); } was once patented actually made me a bit sad for our entire system of patents.
Why is math patentable? seems crazy to me
Though actually it shouldn't be patented because it's an obvious implementation of a math formula (and math is not patentable).