/* If 64-bit operations are not supported, then ASSERT(). If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT64 EFIAPI BitFieldAnd64(IN UINT64 Operand, IN UINTN StartBit, IN UINTN EndBit, IN UINT64 AndData)
/* If 64-bit operations are not supported, then ASSERT(). If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT64 EFIAPI BitFieldAnd64(IN UINT64 Operand, IN UINTN StartBit, IN UINTN EndBit, IN UINT64 AndData)
{
  UINT64  Value1;
  UINT64  Value2;
  ASSERT (EndBit < 64);
  ASSERT (StartBit <= EndBit);
  ASSERT (RShiftU64 (AndData, EndBit - StartBit) == (RShiftU64 (AndData, EndBit - StartBit) & 1));
  Value1 = LShiftU64 (~AndData, StartBit);
  Value2 = LShiftU64 ((UINT64)-2, EndBit);
  return Operand & ~(Value1 & ~Value2);
}