3 ms·
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 th
by Gankro 10y ago
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)
- deleted 10y ago[deleted]