@Test public void setMaskMultiByte() { int old = 0xdeadbeef; int mask = 0x0f_ff_f0_00; int newVal = IntUtils.setMaskedBits(old, mask, 0xabcd); assertEquals(0xdabcdeef, newVal); }
public static int setMaskedBits(int wholeElement,int mask, int value) { int clearMask = ~mask; int shift = Integer.numberOfTrailingZeros(mask); value = value << shift; wholeElement &= clearMask; wholeElement |= (mask & value); return wholeElement; }
IntUtils { public static int setMaskedBits(int wholeElement,int mask, int value) { int clearMask = ~mask; int shift = Integer.numberOfTrailingZeros(mask); value = value << shift; wholeElement &= clearMask; wholeElement |= (mask & value); return wholeElement; } }
IntUtils { public static int setMaskedBits(int wholeElement,int mask, int value) { int clearMask = ~mask; int shift = Integer.numberOfTrailingZeros(mask); value = value << shift; wholeElement &= clearMask; wholeElement |= (mask & value); return wholeElement; } private  IntUtils(); }
IntUtils { public static int setMaskedBits(int wholeElement,int mask, int value) { int clearMask = ~mask; int shift = Integer.numberOfTrailingZeros(mask); value = value << shift; wholeElement &= clearMask; wholeElement |= (mask & value); return wholeElement; } private  IntUtils(); static Long unsignedIntToLong(int value); static int setMaskedBits(int wholeElement,int mask, int value); static int getFromMask(int unmasked, int mask); static int setMaskedBitsLE(int wholeElement, int mask, int value); static int setMaskedBitsLE(int wholeElement, int mask, int value, int numBits); static int getFromMaskLE(int unmasked, int mask, int numBits); static int maxValueThatFits(int mask); static int maxSigned(int numBits); static int maxUnsigned(int numBits); }
IntUtils { public static int setMaskedBits(int wholeElement,int mask, int value) { int clearMask = ~mask; int shift = Integer.numberOfTrailingZeros(mask); value = value << shift; wholeElement &= clearMask; wholeElement |= (mask & value); return wholeElement; } private  IntUtils(); static Long unsignedIntToLong(int value); static int setMaskedBits(int wholeElement,int mask, int value); static int getFromMask(int unmasked, int mask); static int setMaskedBitsLE(int wholeElement, int mask, int value); static int setMaskedBitsLE(int wholeElement, int mask, int value, int numBits); static int getFromMaskLE(int unmasked, int mask, int numBits); static int maxValueThatFits(int mask); static int maxSigned(int numBits); static int maxUnsigned(int numBits); static final int BYTES; }