Hacker News new | ask | show | jobs
by c-linkage 1595 days ago
Just use the following code and you should be good!

  unsigned average(unsigned a, unsigned b)
  {
      return (a >> 1) + (b >> 1) + (a & b & 1);
  }