public static bool IsValidOperandSize(CpuType type, DataSize operandSize)
        {
            #region Contract
            Contract.Requires <InvalidEnumArgumentException>(Enum.IsDefined(typeof(DataSize), operandSize));
            #endregion

            if (type != null)
            {
                // Test whether the specified operand size is part of the list
                // of allowed operating modes for the CPU type.
                return((type.OperatingModes & operandSize) != 0);
            }
            else
            {
                return(operandSize == DataSize.Bit16 ||
                       operandSize == DataSize.Bit32 ||
                       operandSize == DataSize.Bit64);
            }
        }
        private static DataSize GetDefaultAddressingMode(CpuType type)
        {
            #region Contract
            Contract.Ensures(Enum.IsDefined(typeof(DataSize), Contract.Result <DataSize>()));
            Contract.Ensures(Contract.Result <DataSize>() != DataSize.None);
            Contract.Ensures(IsValidAddressSize(type, Contract.Result <DataSize>()));
            #endregion

            // By default: 32-bit.
            DataSize addressSize = DataSize.Bit32;

            if (!IsValidAddressSize(type, addressSize))
            {
                // 32-bit not possible? Try 16-bit.
                addressSize = DataSize.Bit16;
            }

            return(addressSize);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="X86Architecture"/> class.
 /// </summary>
 /// <param name="type">The type of CPU.</param>
 /// <remarks>
 /// The <see cref="Features"/> are set according to the selected <paramref name="type"/>.
 /// </remarks>
 public X86Architecture(CpuType type)
     : this(type, CpuFeatures.None, DataSize.None)
 {
 }