Hacker News new | ask | show | jobs
by Jensson 1326 days ago
Or

    x / 2 + y / 2 + (x & y & 1)
Edit: This is the same you wrote, but it gets the wrong number for negative values, for negative ints the rounding will go up and not down.