namespace ARMeilleure.Common
{
///
/// Represents a level in an .
///
public readonly struct AddressTableLevel
{
///
/// Gets the index of the in the guest address.
///
public int Index { get; }
///
/// Gets the length of the in the guest address.
///
public int Length { get; }
///
/// Gets the mask which masks the bits used by the .
///
public ulong Mask => ((1ul << Length) - 1) << Index;
///
/// Initializes a new instance of the structure with the specified
/// and .
///
/// Index of the
/// Length of the
public AddressTableLevel(int index, int length)
{
(Index, Length) = (index, length);
}
///
/// Gets the value of the from the specified guest .
///
/// Guest address
/// Value of the from the specified guest
public int GetValue(ulong address)
{
return (int)((address & Mask) >> Index);
}
}
}