LANG-1240: Optimize BitField constructor implementation (closes #119)
This commit is contained in:
parent
afedbae8ac
commit
84d52919ec
|
@ -84,16 +84,7 @@ public class BitField {
|
||||||
*/
|
*/
|
||||||
public BitField(final int mask) {
|
public BitField(final int mask) {
|
||||||
_mask = mask;
|
_mask = mask;
|
||||||
int count = 0;
|
_shift_count = mask != 0 ? Integer.numberOfTrailingZeros(mask) : 0;
|
||||||
int bit_pattern = mask;
|
|
||||||
|
|
||||||
if (bit_pattern != 0) {
|
|
||||||
while ((bit_pattern & 1) == 0) {
|
|
||||||
count++;
|
|
||||||
bit_pattern >>= 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_shift_count = count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue