LANG-1240: Optimize BitField constructor implementation (closes #119)

This commit is contained in:
zhanhb 2015-12-14 15:29:26 +08:00 committed by pascalschumacher
parent afedbae8ac
commit 84d52919ec
1 changed files with 1 additions and 10 deletions

View File

@ -84,16 +84,7 @@ public class BitField {
*/
public BitField(final int mask) {
_mask = mask;
int count = 0;
int bit_pattern = mask;
if (bit_pattern != 0) {
while ((bit_pattern & 1) == 0) {
count++;
bit_pattern >>= 1;
}
}
_shift_count = count;
_shift_count = mask != 0 ? Integer.numberOfTrailingZeros(mask) : 0;
}
/**