What is simplest way to assign a bit mask to integer value?
For example I want integer with first, third and forth bits = 1, other = 0.
Certainly I am looking for code, not for single value! And certainly there lot of possibilities, but I try to find simplest and most descriptive looking
I think the best way to think (!) is to just index bits from 0, and then apply “to set the n:th bit, bitwise-OR with the value (1 << n)”: