Show / Hide Table of Contents

    Class IntegerConstant

    Describes an integer value that adheres to an integer spec.

    Inheritance
    System.Object
    Constant
    IntegerConstant
    Implements
    System.IEquatable<Constant>
    System.IComparable<IntegerConstant>
    System.IEquatable<IntegerConstant>
    System.IComparable
    Inherited Members
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Flame.Constants
    Assembly: Flame.dll
    Syntax
    public sealed class IntegerConstant : Constant, IEquatable<Constant>, IComparable<IntegerConstant>, IEquatable<IntegerConstant>, IComparable

    Constructors

    | Improve this Doc View Source

    IntegerConstant(Boolean)

    Creates an integer value that wraps the given boolean.

    Declaration
    public IntegerConstant(bool value)
    Parameters
    Type Name Description
    System.Boolean value
    Remarks

    The resulting integer value's spec is that of a one-bit unsigned integer.

    | Improve this Doc View Source

    IntegerConstant(Byte)

    Creates an integer value that wraps the given integer.

    Declaration
    public IntegerConstant(byte value)
    Parameters
    Type Name Description
    System.Byte value
    | Improve this Doc View Source

    IntegerConstant(Char)

    Creates an integer value that wraps the given cbaracter value.

    Declaration
    public IntegerConstant(char value)
    Parameters
    Type Name Description
    System.Char value
    | Improve this Doc View Source

    IntegerConstant(Int16)

    Creates an integer value that wraps the given integer.

    Declaration
    public IntegerConstant(short value)
    Parameters
    Type Name Description
    System.Int16 value
    | Improve this Doc View Source

    IntegerConstant(Int32)

    Creates an integer value that wraps the given integer.

    Declaration
    public IntegerConstant(int value)
    Parameters
    Type Name Description
    System.Int32 value
    | Improve this Doc View Source

    IntegerConstant(Int64)

    Creates an integer value that wraps the given integer.

    Declaration
    public IntegerConstant(long value)
    Parameters
    Type Name Description
    System.Int64 value
    | Improve this Doc View Source

    IntegerConstant(BigInteger, IntegerSpec)

    Creates an integer value from the given integer and an integer spec.

    Declaration
    public IntegerConstant(BigInteger value, IntegerSpec spec)
    Parameters
    Type Name Description
    System.Numerics.BigInteger value
    IntegerSpec spec
    | Improve this Doc View Source

    IntegerConstant(SByte)

    Creates an integer value that wraps the given integer.

    Declaration
    public IntegerConstant(sbyte value)
    Parameters
    Type Name Description
    System.SByte value
    Remarks

    The resulting integer value's spec is that of a sixteen-bit unsigned integer.

    | Improve this Doc View Source

    IntegerConstant(UInt16)

    Creates an integer value that wraps the given integer.

    Declaration
    public IntegerConstant(ushort value)
    Parameters
    Type Name Description
    System.UInt16 value
    | Improve this Doc View Source

    IntegerConstant(UInt32)

    Creates an integer value that wraps the given integer.

    Declaration
    public IntegerConstant(uint value)
    Parameters
    Type Name Description
    System.UInt32 value
    | Improve this Doc View Source

    IntegerConstant(UInt64)

    Creates an integer value that wraps the given integer.

    Declaration
    public IntegerConstant(ulong value)
    Parameters
    Type Name Description
    System.UInt64 value

    Properties

    | Improve this Doc View Source

    AbsoluteValue

    Gets this integer value's absolute value.

    Declaration
    public IntegerConstant AbsoluteValue { get; }
    Property Value
    Type Description
    IntegerConstant

    This integer value's absolute value.

    | Improve this Doc View Source

    IsEven

    Gets a Boolean that tells if this integer is divisible by two.

    Declaration
    public bool IsEven { get; }
    Property Value
    Type Description
    System.Boolean

    true if this integer value is divisible by two; otherwise, false.

    | Improve this Doc View Source

    IsNegative

    Gets a Boolean that tells if this integer is less than zero.

    Declaration
    public bool IsNegative { get; }
    Property Value
    Type Description
    System.Boolean

    true if this integer value is less than zero; otherwise, false.

    | Improve this Doc View Source

    IsNonNegative

    Gets a Boolean that tells if this integer is greater than or equal to zero.

    Declaration
    public bool IsNonNegative { get; }
    Property Value
    Type Description
    System.Boolean

    true if this integer value is greater than or equal to zero; otherwise, false.

    | Improve this Doc View Source

    IsNonPositive

    Gets a Boolean that tells if this integer is less than or equal to zero.

    Declaration
    public bool IsNonPositive { get; }
    Property Value
    Type Description
    System.Boolean

    true if this integer value is less than or equal to zero; otherwise, false.

    | Improve this Doc View Source

    IsOdd

    Gets a Boolean that tells if this integer is not divisible by two.

    Declaration
    public bool IsOdd { get; }
    Property Value
    Type Description
    System.Boolean

    true if this integer value is not divisible by two; otherwise, false.

    | Improve this Doc View Source

    IsPositive

    Gets a Boolean that tells if this integer is greater than zero.

    Declaration
    public bool IsPositive { get; }
    Property Value
    Type Description
    System.Boolean

    true if this integer value is greater than zero; otherwise, false.

    | Improve this Doc View Source

    IsPowerOfTwo

    Gets a Boolean that tells if this integer is a power of two.

    Declaration
    public bool IsPowerOfTwo { get; }
    Property Value
    Type Description
    System.Boolean

    true if this integer value is a power of two; otherwise, false.

    | Improve this Doc View Source

    IsValid

    Checks if this value is valid, i.e. it conforms to the given spec.

    Declaration
    public bool IsValid { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    IsZero

    Gets a Boolean that tells if this integer is zero.

    Declaration
    public bool IsZero { get; }
    Property Value
    Type Description
    System.Boolean

    true if this integer value is zero; otherwise, false.

    | Improve this Doc View Source

    Negated

    Gets the negated value of this integer. This may or may not be representible by the integer spec this value adheres to.

    Declaration
    public IntegerConstant Negated { get; }
    Property Value
    Type Description
    IntegerConstant
    | Improve this Doc View Source

    Normalized

    Gets a normalized value. A normalized value will always conform to the integer spec.

    Declaration
    public IntegerConstant Normalized { get; }
    Property Value
    Type Description
    IntegerConstant
    | Improve this Doc View Source

    OnesComplement

    Gets the one's complement of this integer.

    Declaration
    public IntegerConstant OnesComplement { get; }
    Property Value
    Type Description
    IntegerConstant
    | Improve this Doc View Source

    Spec

    Gets this integer's spec, which defines its size and signedness.

    Declaration
    public IntegerSpec Spec { get; }
    Property Value
    Type Description
    IntegerSpec
    | Improve this Doc View Source

    TrailingZeroCount

    Gets the number of trailing zero bits in this integer value

    Declaration
    public int TrailingZeroCount { get; }
    Property Value
    Type Description
    System.Int32

    The number of trailing zero bits in this integer value.

    | Improve this Doc View Source

    Value

    Gets this integer's value.

    Declaration
    public BigInteger Value { get; }
    Property Value
    Type Description
    System.Numerics.BigInteger

    Methods

    | Improve this Doc View Source

    Add(IntegerConstant)

    Adds the given integer to this integer. The result retains this integer's spec.

    Declaration
    public IntegerConstant Add(IntegerConstant other)
    Parameters
    Type Name Description
    IntegerConstant other
    Returns
    Type Description
    IntegerConstant
    | Improve this Doc View Source

    BitwiseAnd(IntegerConstant)

    Applies the bitwise 'and' operator to this integer and the given other integer. The result retains this integer's spec.

    Declaration
    public IntegerConstant BitwiseAnd(IntegerConstant other)
    Parameters
    Type Name Description
    IntegerConstant other
    Returns
    Type Description
    IntegerConstant
    | Improve this Doc View Source

    BitwiseOr(IntegerConstant)

    Applies the bitwise 'or' operator to this integer and the given other integer. The result retains this integer's spec.

    Declaration
    public IntegerConstant BitwiseOr(IntegerConstant other)
    Parameters
    Type Name Description
    IntegerConstant other
    Returns
    Type Description
    IntegerConstant
    | Improve this Doc View Source

    BitwiseXor(IntegerConstant)

    Applies the bitwise 'xor' operator to this integer and the given other integer. The result retains this integer's spec.

    Declaration
    public IntegerConstant BitwiseXor(IntegerConstant other)
    Parameters
    Type Name Description
    IntegerConstant other
    Returns
    Type Description
    IntegerConstant
    | Improve this Doc View Source

    Cast(IntegerSpec)

    Casts this integer value to match the given spec.

    Declaration
    public IntegerConstant Cast(IntegerSpec newSpec)
    Parameters
    Type Name Description
    IntegerSpec newSpec
    Returns
    Type Description
    IntegerConstant
    | Improve this Doc View Source

    CastSignedness(Boolean)

    Extends or wraps this integer to match the given signedness.

    Declaration
    public IntegerConstant CastSignedness(bool isSigned)
    Parameters
    Type Name Description
    System.Boolean isSigned
    Returns
    Type Description
    IntegerConstant
    | Improve this Doc View Source

    CastSize(Int32)

    Extends or wraps this integer to match the given number of bits.

    Declaration
    public IntegerConstant CastSize(int size)
    Parameters
    Type Name Description
    System.Int32 size
    Returns
    Type Description
    IntegerConstant
    | Improve this Doc View Source

    CompareTo(IntegerConstant)

    Compares this integer value to the given integer value.

    Declaration
    public int CompareTo(IntegerConstant other)
    Parameters
    Type Name Description
    IntegerConstant other
    Returns
    Type Description
    System.Int32
    | Improve this Doc View Source

    CompareTo(Object)

    Compares this integer value to the given object.

    Declaration
    public int CompareTo(object other)
    Parameters
    Type Name Description
    System.Object other
    Returns
    Type Description
    System.Int32
    | Improve this Doc View Source

    ComputeSignedDivisionMagic()

    Calculate the magic numbers required to implement a signed integer division by a constant as a sequence of multiplies, adds and shifts. Requires that the divisor not be 0, 1 or -1.

    Declaration
    public SignedDivisionMagic ComputeSignedDivisionMagic()
    Returns
    Type Description
    SignedDivisionMagic

    The magic numbers required to implement an unsigned integer division by a constant as a sequence of multiplies, adds and shifts.

    | Improve this Doc View Source

    ComputeUnsignedDivisionMagic()

    Calculate the magic numbers required to implement an unsigned integer division by a constant as a sequence of multiplies, adds and shifts. Requires that the divisor not be 0.

    Declaration
    public UnsignedDivisionMagic ComputeUnsignedDivisionMagic()
    Returns
    Type Description
    UnsignedDivisionMagic

    The magic numbers required to implement an unsigned integer division by a constant as a sequence of multiplies, adds and shifts.

    | Improve this Doc View Source

    ComputeUnsignedDivisionMagic(Int32)

    Calculate the magic numbers required to implement an unsigned integer division by a constant as a sequence of multiplies, adds and shifts. Requires that the divisor not be 0.

    Declaration
    public UnsignedDivisionMagic ComputeUnsignedDivisionMagic(int leadingZeros)
    Parameters
    Type Name Description
    System.Int32 leadingZeros

    The number of upper bits in the divided value that are known to be zero.

    Returns
    Type Description
    UnsignedDivisionMagic

    The magic numbers required to implement an unsigned integer division by a constant as a sequence of multiplies, adds and shifts.

    | Improve this Doc View Source

    Divide(IntegerConstant)

    Divides this integer by the given integer. The result retains this integer's spec.

    Declaration
    public IntegerConstant Divide(IntegerConstant other)
    Parameters
    Type Name Description
    IntegerConstant other
    Returns
    Type Description
    IntegerConstant
    | Improve this Doc View Source

    Equals(Constant)

    Tests if this constant is equal to another constant.

    Declaration
    public override bool Equals(Constant other)
    Parameters
    Type Name Description
    Constant other

    The other constant.

    Returns
    Type Description
    System.Boolean

    true if the constants are equal; otherwise, false.

    Overrides
    Constant.Equals(Constant)
    | Improve this Doc View Source

    Equals(IntegerConstant)

    Tests if this integer constant equals another integer constant, both in terms of value and spec.

    Declaration
    public bool Equals(IntegerConstant other)
    Parameters
    Type Name Description
    IntegerConstant other

    An integer constant.

    Returns
    Type Description
    System.Boolean

    true if the integer constants are equal; otherwise, false.

    | Improve this Doc View Source

    Equals(Object)

    Declaration
    public override bool Equals(object other)
    Parameters
    Type Name Description
    System.Object other
    Returns
    Type Description
    System.Boolean
    Overrides
    Constant.Equals(Object)
    | Improve this Doc View Source

    GetHashCode()

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    System.Int32
    Overrides
    Constant.GetHashCode()
    | Improve this Doc View Source

    IntegerLog(IntegerConstant)

    Computes the integer logarithm of this integer value in the specified base. The integer logarithm is equal to the number of times the base can be multiplied by itself without exceeding this integer value.

    Declaration
    public IntegerConstant IntegerLog(IntegerConstant baseValue)
    Parameters
    Type Name Description
    IntegerConstant baseValue

    The base of the logarithm.

    Returns
    Type Description
    IntegerConstant

    The integer logarithm of this integer value in the specified base.

    | Improve this Doc View Source

    IsGreaterThan(IntegerConstant)

    Tests if this integer value is greater than the given value.

    Declaration
    public bool IsGreaterThan(IntegerConstant Other)
    Parameters
    Type Name Description
    IntegerConstant Other

    The right-hand side of the comparison.

    Returns
    Type Description
    System.Boolean

    true if this integer is greater than the given integer; otherwise, false.

    | Improve this Doc View Source

    IsGreaterThanOrEqual(IntegerConstant)

    Tests if this integer value is greater than or equal to the given value.

    Declaration
    public bool IsGreaterThanOrEqual(IntegerConstant other)
    Parameters
    Type Name Description
    IntegerConstant other

    The right-hand side of the comparison.

    Returns
    Type Description
    System.Boolean

    true if this integer is greater than or equal to the given integer; otherwise, false.

    | Improve this Doc View Source

    IsLessThan(IntegerConstant)

    Tests if this integer value is less than the given value.

    Declaration
    public bool IsLessThan(IntegerConstant other)
    Parameters
    Type Name Description
    IntegerConstant other

    The right-hand side of the comparison.

    Returns
    Type Description
    System.Boolean

    true if this integer is less than the given integer; otherwise, false.

    | Improve this Doc View Source

    IsLessThanOrEqual(IntegerConstant)

    Tests if this integer value is less than or equal to the given value.

    Declaration
    public bool IsLessThanOrEqual(IntegerConstant other)
    Parameters
    Type Name Description
    IntegerConstant other

    The right-hand side of the comparison.

    Returns
    Type Description
    System.Boolean

    true if this integer is less than or equal to the given integer; otherwise, false.

    | Improve this Doc View Source

    Log(Double)

    Computes the logarithm of this integer value in the specified base.

    Declaration
    public double Log(double baseValue)
    Parameters
    Type Name Description
    System.Double baseValue

    The base of the logarithm.

    Returns
    Type Description
    System.Double

    The logarithm of this integer value in the specified base.

    | Improve this Doc View Source

    Multiply(IntegerConstant)

    Multiplies the given integer with this integer. The result retains this integer's spec.

    Declaration
    public IntegerConstant Multiply(IntegerConstant other)
    Parameters
    Type Name Description
    IntegerConstant other
    Returns
    Type Description
    IntegerConstant
    | Improve this Doc View Source

    Remainder(IntegerConstant)

    Computes the remainder of the division of this integer by the given integer. The result retains this integer's spec.

    Declaration
    public IntegerConstant Remainder(IntegerConstant other)
    Parameters
    Type Name Description
    IntegerConstant other
    Returns
    Type Description
    IntegerConstant
    | Improve this Doc View Source

    ShiftLeft(IntegerConstant)

    Applies the bitwise left shift operator to this integer and the given other integer. The result retains this integer's spec.

    Declaration
    public IntegerConstant ShiftLeft(IntegerConstant shiftAmount)
    Parameters
    Type Name Description
    IntegerConstant shiftAmount
    Returns
    Type Description
    IntegerConstant
    | Improve this Doc View Source

    ShiftLeft(Int32)

    Applies the bitwise left shift operator to this integer and the given other integer. The result retains this integer's spec.

    Declaration
    public IntegerConstant ShiftLeft(int shiftAmount)
    Parameters
    Type Name Description
    System.Int32 shiftAmount
    Returns
    Type Description
    IntegerConstant
    | Improve this Doc View Source

    ShiftRight(IntegerConstant)

    Applies the bitwise right shift operator to this integer and the given other integer. The result retains this integer's spec.

    Declaration
    public IntegerConstant ShiftRight(IntegerConstant shiftAmount)
    Parameters
    Type Name Description
    IntegerConstant shiftAmount
    Returns
    Type Description
    IntegerConstant
    | Improve this Doc View Source

    ShiftRight(Int32)

    Applies the bitwise right shift operator to this integer and the given other integer. The result retains this integer's spec.

    Declaration
    public IntegerConstant ShiftRight(int shiftAmount)
    Parameters
    Type Name Description
    System.Int32 shiftAmount
    Returns
    Type Description
    IntegerConstant
    | Improve this Doc View Source

    Subtract(IntegerConstant)

    Subtracts the given integer from this integer. The result retains this integer's spec.

    Declaration
    public IntegerConstant Subtract(IntegerConstant other)
    Parameters
    Type Name Description
    IntegerConstant other
    Returns
    Type Description
    IntegerConstant
    | Improve this Doc View Source

    ToBoolean()

    Converts this integer value to a Boolean.

    Declaration
    public bool ToBoolean()
    Returns
    Type Description
    System.Boolean
    | Improve this Doc View Source

    ToFloat32()

    Converts this integer value to a 32-bit floating point number.

    Declaration
    public float ToFloat32()
    Returns
    Type Description
    System.Single
    | Improve this Doc View Source

    ToFloat64()

    Converts this integer value to a 64-bit floating point number.

    Declaration
    public double ToFloat64()
    Returns
    Type Description
    System.Double
    | Improve this Doc View Source

    ToInt16()

    Converts this integer value to a 16-bit signed integer.

    Declaration
    public short ToInt16()
    Returns
    Type Description
    System.Int16
    | Improve this Doc View Source

    ToInt32()

    Converts this integer value to a 32-bit signed integer.

    Declaration
    public int ToInt32()
    Returns
    Type Description
    System.Int32
    | Improve this Doc View Source

    ToInt64()

    Converts this integer value to a 64-bit signed integer.

    Declaration
    public long ToInt64()
    Returns
    Type Description
    System.Int64
    | Improve this Doc View Source

    ToInt8()

    Converts this integer value to an 8-bit signed integer.

    Declaration
    public sbyte ToInt8()
    Returns
    Type Description
    System.SByte
    | Improve this Doc View Source

    ToString()

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String
    Overrides
    System.Object.ToString()
    | Improve this Doc View Source

    ToUInt16()

    Converts this integer value to a 16-bit unsigned integer.

    Declaration
    public ushort ToUInt16()
    Returns
    Type Description
    System.UInt16
    | Improve this Doc View Source

    ToUInt32()

    Converts this integer value to a 32-bit unsigned integer.

    Declaration
    public uint ToUInt32()
    Returns
    Type Description
    System.UInt32
    | Improve this Doc View Source

    ToUInt64()

    Converts this integer value to a 64-bit unsigned integer.

    Declaration
    public ulong ToUInt64()
    Returns
    Type Description
    System.UInt64
    | Improve this Doc View Source

    ToUInt8()

    Converts this integer value to an 8-bit unsigned integer.

    Declaration
    public byte ToUInt8()
    Returns
    Type Description
    System.Byte

    Implements

    System.IEquatable<T>
    System.IComparable<T>
    System.IEquatable<T>
    System.IComparable
    • Improve this Doc
    • View Source
    Back to top Generated by DocFX