Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There is an `if` statement in a `for` loop that looks like it could be eliminated. Abbreviating:

  if (dd.all >= dr.all) {
    dd.all -= dr.all;
    quo.s.low |= 1;
  }
could be

  bool c = dd.all >= dr.all;
  dd.all -= (-c & dr.all);
  quo.s.low |= c;

Clang might implement this with `cmov` instructions, coded either way.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: