is there way can generate bit mask of number without changing number itself?
i new programming , have seen hard-coded bit-masks only.
can operations on number generate bitmask, number (i.e.: dynamically generated mask, depending value of number)
thanks.
why not? use number mask:
//returns true if bit n 1 , false otherwise bool get(int index, int mask) { return (mask >> index) & 1; }
Comments
Post a Comment