Lines Matching defs:cBits

393  * Shifts a 128-bit unsigned integer value @a cBits to the left.
398 * @param cBits The number of bits to shift it.
400 DECLINLINE(PRTUINT128U) RTUInt128ShiftLeft(PRTUINT128U pResult, PCRTUINT128U pValue, int cBits)
402 cBits &= 127;
403 if (cBits < 64)
405 pResult->s.Lo = pValue->s.Lo << cBits;
406 pResult->s.Hi = (pValue->s.Hi << cBits) | (pValue->s.Lo >> (64 - cBits));
411 pResult->s.Hi = pValue->s.Lo << (cBits - 64);
418 * Shifts a 128-bit unsigned integer value @a cBits to the right.
423 * @param cBits The number of bits to shift it.
425 DECLINLINE(PRTUINT128U) RTUInt128ShiftRight(PRTUINT128U pResult, PCRTUINT128U pValue, int cBits)
427 cBits &= 127;
428 if (cBits < 64)
430 pResult->s.Hi = pValue->s.Hi >> cBits;
431 pResult->s.Lo = (pValue->s.Lo >> cBits) | (pValue->s.Hi << (64 - cBits));
436 pResult->s.Lo = pValue->s.Hi >> (cBits - 64);
733 * @param cBits The number of bits to AND (counting from the first
736 DECLINLINE(PRTUINT128U) RTUInt128AssignAndNFirstBits(PRTUINT128U pValueResult, unsigned cBits)
738 if (cBits <= 64)
740 if (cBits != 64)
741 pValueResult->s.Lo &= (RT_BIT_64(cBits) - 1);
744 else if (cBits < 128)
745 pValueResult->s.Hi &= (RT_BIT_64(cBits - 64) - 1);
838 * @param cBits The number of bits to shift.
840 DECLINLINE(PRTUINT128U) RTUInt128AssignShiftLeft(PRTUINT128U pValueResult, int cBits)
844 if (cBits > 0)
847 if (cBits >= 128)
849 else if (cBits >= 64)
852 pValueResult->s.Hi = InVal.s.Lo << (cBits - 64);
856 pValueResult->s.Hi = InVal.s.Hi << cBits;
857 pValueResult->s.Hi |= InVal.s.Lo >> (64 - cBits);
858 pValueResult->s.Lo = InVal.s.Lo << cBits;
861 else if (cBits < 0)
864 cBits = -cBits;
865 if (cBits >= 128)
867 else if (cBits >= 64)
870 pValueResult->s.Lo = InVal.s.Hi >> (cBits - 64);
874 pValueResult->s.Lo = InVal.s.Lo >> cBits;
875 pValueResult->s.Lo |= InVal.s.Hi << (64 - cBits);
876 pValueResult->s.Hi = InVal.s.Hi >> cBits;
889 * @param cBits The number of bits to shift.
891 DECLINLINE(PRTUINT128U) RTUInt128AssignShiftRight(PRTUINT128U pValueResult, int cBits)
893 return RTUInt128AssignShiftLeft(pValueResult, -cBits);
1187 * @param cBits The number of bits to set.
1189 DECLINLINE(PRTUINT128U) RTUInt128BitSetRange(PRTUINT128U pValueResult, unsigned iFirstBit, unsigned cBits)
1194 if (iFirstBit + cBits > 128)
1195 cBits = 128 - iFirstBit;
1198 if (iFirstBit + cBits < 64)
1199 pValueResult->s.Lo |= (RT_BIT_64(cBits) - 1) << iFirstBit;
1200 else if (iFirstBit + cBits < 128 && iFirstBit >= 64)
1201 pValueResult->s.Hi |= (RT_BIT_64(cBits) - 1) << (iFirstBit - 64);
1204 if (iFirstBit + cBits < 32)
1205 pValueResult->DWords.dw0 |= (RT_BIT_32(cBits) - 1) << iFirstBit;
1206 else if (iFirstBit + cBits < 64 && iFirstBit >= 32)
1207 pValueResult->DWords.dw1 |= (RT_BIT_32(cBits) - 1) << (iFirstBit - 32);
1208 else if (iFirstBit + cBits < 96 && iFirstBit >= 64)
1209 pValueResult->DWords.dw2 |= (RT_BIT_32(cBits) - 1) << (iFirstBit - 64);
1210 else if (iFirstBit + cBits < 128 && iFirstBit >= 96)
1211 pValueResult->DWords.dw3 |= (RT_BIT_32(cBits) - 1) << (iFirstBit - 96);
1214 while (cBits-- > 0)
1263 uint32_t cBits;
1267 cBits = 96 + ASMBitLastSetU32(pValue->DWords.dw3);
1269 cBits = 64 + ASMBitLastSetU32(pValue->DWords.dw2);
1274 cBits = 32 + ASMBitLastSetU32(pValue->DWords.dw1);
1276 cBits = 0 + ASMBitLastSetU32(pValue->DWords.dw0);
1278 return cBits;