/* If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
UINT8 EFIAPI BitFieldCountOnes64(IN UINT64 Operand, IN UINTN StartBit, IN UINTN EndBit)
/* If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
UINT8 EFIAPI BitFieldCountOnes64(IN UINT64 Operand, IN UINTN StartBit, IN UINTN EndBit)
{
  UINT64  BitField;
  UINT8   Count;
  ASSERT (EndBit < 64);
  ASSERT (StartBit <= EndBit);
  BitField = BitFieldRead64 (Operand, StartBit, EndBit);
  Count    = BitFieldCountOnes32 ((UINT32)BitField, 0, 31);
  Count   += BitFieldCountOnes32 ((UINT32)RShiftU64 (BitField, 32), 0, 31);
  return Count;
}