I found some interesting bit twiddling in \"source\\common\\unicode\\utf.h\" file of ICU library (International Components for Unicode). The bit twiddling is intend
The formula works whenever the range you are looking for starts at a multiple of a power of 2 (that is, 1 or more bits at the low end of the binary form of the number ends in 0) and the size of the range is 2^n-1 (that is, low&high == low and low|high == high).