News for hackers. Stuff that matters.
Re:Can you trust a compiler to optimize your code? by secondcoming on Tuesday August 01, 2023 @11:29AM (#36957280)
> ‘&’ doesn’t short circuit

Is this always true? I’ve experimented with this optimisation before but backed away from using it in production because it felt iffy to do. The codegen was far better though

Re:Can you trust a compiler to optimize your code? by Izkata on Tuesday August 01, 2023 @05:23PM (#36963184)
Single & (and single | for "or") are bitwise and/or, not logical and/or. They have to evaluate both sides to be able to return a result.

For example:

  1100 & 0101 -> 0100
  1100 | 0101 -> 1101