They say incrementing is easy

Submitted By: admin on June 3, 2017

1

0

5351

They say incrementing is easy Source: www.reddit.com

static unsigned inc(unsigned n) {

  for (unsigned bit = 1; bit; bit <<= 1)

    if ((n ^= bit) & bit) break;

  return n;

}

- myon98

Site Comments (0)

Please Signin or Signup to add a comment