Class IntegerSpec
Describes the size and signedness of an integer. Signed integers are
assumed to use a two's complement scheme.
Inheritance
System.Object
IntegerSpec
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
Assembly: Flame.dll
Syntax
public sealed class IntegerSpec : IEquatable<IntegerSpec>
Constructors
|
Improve this Doc
View Source
IntegerSpec(Int32, Boolean)
Creates an integer size from the given number of bits,
and signedness.
Declaration
public IntegerSpec(int size, bool isSigned)
Parameters
Type |
Name |
Description |
System.Int32 |
size |
|
System.Boolean |
isSigned |
|
Properties
|
Improve this Doc
View Source
DataSize
Gets the number of bits this integer represents, minus the sign
bit, if there is a sign bit.
Declaration
public int DataSize { get; }
Property Value
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
Int16
Gets the integer spec for 16-bit signed integers.
Declaration
public static IntegerSpec Int16 { get; }
Property Value
|
Improve this Doc
View Source
Int32
Gets the integer spec for 32-bit signed integers.
Declaration
public static IntegerSpec Int32 { get; }
Property Value
|
Improve this Doc
View Source
Int64
Gets the integer spec for 64-bit signed integers.
Declaration
public static IntegerSpec Int64 { get; }
Property Value
|
Improve this Doc
View Source
Int8
Gets the integer spec for 8-bit signed integers.
Declaration
public static IntegerSpec Int8 { get; }
Property Value
|
Improve this Doc
View Source
IsSigned
Gets a boolean value that tells if conforming integers
have a sign bit or not.
Declaration
public bool IsSigned { get; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
MaxValue
Gets the biggest integer for this spec.
Declaration
public BigInteger MaxValue { get; }
Property Value
Type |
Description |
System.Numerics.BigInteger |
|
|
Improve this Doc
View Source
MinValue
Gets the smallest integer for this spec.
Declaration
public BigInteger MinValue { get; }
Property Value
Type |
Description |
System.Numerics.BigInteger |
|
|
Improve this Doc
View Source
Modulus
Gets the modulus for this integer spec: two to the power
of the number of data bits.
Declaration
public BigInteger Modulus { get; }
Property Value
Type |
Description |
System.Numerics.BigInteger |
|
|
Improve this Doc
View Source
SignedVariant
Gets the signed variant of this integer spec, that is, a signed integer spec
of the same size as this integer spec.
Declaration
public IntegerSpec SignedVariant { get; }
Property Value
Type |
Description |
IntegerSpec |
A signed integer spec of the same size as this integer spec.
|
|
Improve this Doc
View Source
Size
Gets the integer size, in bits.
Declaration
Property Value
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
UInt1
Gets the integer spec for 1-bit unsigned integers.
Declaration
public static IntegerSpec UInt1 { get; }
Property Value
|
Improve this Doc
View Source
UInt16
Gets the integer spec for 16-bit unsigned integers.
Declaration
public static IntegerSpec UInt16 { get; }
Property Value
|
Improve this Doc
View Source
UInt32
Gets the integer spec for 32-bit unsigned integers.
Declaration
public static IntegerSpec UInt32 { get; }
Property Value
|
Improve this Doc
View Source
UInt64
Gets the integer spec for 64-bit unsigned integers.
Declaration
public static IntegerSpec UInt64 { get; }
Property Value
|
Improve this Doc
View Source
UInt8
Gets the integer spec for 8-bit unsigned integers.
Declaration
public static IntegerSpec UInt8 { get; }
Property Value
|
Improve this Doc
View Source
UnsignedModulus
Gets the modulus for this integer spec: two to the power
of the number of total bits.
Declaration
public BigInteger UnsignedModulus { get; }
Property Value
Type |
Description |
System.Numerics.BigInteger |
|
|
Improve this Doc
View Source
UnsignedVariant
Gets the unsigned variant of this integer spec, that is, an unsigned integer spec
of the same size as this integer spec.
Declaration
public IntegerSpec UnsignedVariant { get; }
Property Value
Type |
Description |
IntegerSpec |
An unsigned integer spec of the same size as this integer spec.
|
Methods
|
Improve this Doc
View Source
Cast(BigInteger, IntegerSpec)
Casts the given integer, which currently matches the given spec,
to match this spec.
Declaration
public BigInteger Cast(BigInteger value, IntegerSpec valueSpec)
Parameters
Type |
Name |
Description |
System.Numerics.BigInteger |
value |
|
IntegerSpec |
valueSpec |
|
Returns
Type |
Description |
System.Numerics.BigInteger |
|
|
Improve this Doc
View Source
Equals(IntegerSpec)
Checks if this integer spec equals another integer spec.
Declaration
public bool Equals(IntegerSpec other)
Parameters
Type |
Name |
Description |
IntegerSpec |
other |
An integer spec.
|
Returns
Type |
Description |
System.Boolean |
true if the integer specs 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
System.Object.Equals(System.Object)
|
Improve this Doc
View Source
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type |
Description |
System.Int32 |
|
Overrides
System.Object.GetHashCode()
|
Improve this Doc
View Source
IsRepresentible(BigInteger)
Checks if the given integer is representible by an integer
value that adheres to this spec.
Declaration
public bool IsRepresentible(BigInteger value)
Parameters
Type |
Name |
Description |
System.Numerics.BigInteger |
value |
|
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
Normalize(BigInteger)
"Normalizes" the given value, by casting it to this integer spec,
from this integer spec. The result of this operation is always
representible, even if the input value is not.
Declaration
public BigInteger Normalize(BigInteger value)
Parameters
Type |
Name |
Description |
System.Numerics.BigInteger |
value |
|
Returns
Type |
Description |
System.Numerics.BigInteger |
|
|
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
TryParse(String, out IntegerSpec)
Tries to parse an integer spec's string representation.
Declaration
public static bool TryParse(string str, out IntegerSpec spec)
Parameters
Type |
Name |
Description |
System.String |
str |
A string representation of an integer spec.
|
IntegerSpec |
spec |
A parsed integer spec.
|
Returns
Type |
Description |
System.Boolean |
true if the string was parsed successfully; otherwise, false .
|
Implements
System.IEquatable<T>