News for hackers. Stuff that matters.
Re:The beauty of bitwise AND by Gankro on Thursday August 04, 2016 @12:52AM (#12223451)
You're correct, it can be changed to `min(a, b)`. A rough proof:

* assume WLOG `a = min(a, b)`

* `a & b` takes the set bits of `a` and produces a subset of them

* the value of an integer is `SUM 2^j` where the j-th bit is set

* removing positive elements from a sum can only make it smaller

* therefore & can only produce a value smaller than `a` (the minimum)

There are no comments on this comment yet.