UInt24 Structure

Represents a 3-byte, 24-bit unsigned integer.

Definition

Namespace: Gemstone.Numeric
Assembly: Gemstone.Numeric (in Gemstone.Numeric.dll) Version: 1.0.110 -- Release Build+e3f505d56ee50c7e3fea40a20d129873a4fafd4c
Inheritance
Object    ValueType    UInt24
Implements
IComparable, IComparableUInt24, IComparableUInt32, IConvertible, IEquatableUInt24, IEquatableUInt32, IFormattable

Remarks

This class behaves like most other intrinsic unsigned integers but allows a 3-byte, 24-bit integer implementation that is often found in many digital-signal processing arenas and different kinds of protocol parsing. An unsigned 24-bit integer is typically used to save storage space on disk where its value range of 0 to 16777215 is sufficient, but the unsigned Int16 value range of 0 to 65535 is too small.

This structure uses an UInt32 internally for storage and most other common expected integer functionality, so using a 24-bit integer will not save memory. However, if the 24-bit unsigned integer range (0 to 16777215) suits your data needs you can save disk space by only storing the three bytes that this integer actually consumes. You can do this by calling the UInt24.GetBytes function to return a three byte binary array that can be serialized to the desired destination and then calling the UInt24.GetValue function to restore the UInt24 value from those three bytes.

All the standard operators for the UInt24 have been fully defined for use with both UInt24 and UInt32 unsigned integers; you should find that without the exception UInt24 can be compared and numerically calculated with an UInt24 or UInt32. Necessary casting should be minimal and typical use should be very simple - just as if you are using any other native unsigned integer.

Constructors

UInt24(UInt24)Creates 24-bit unsigned integer from an existing 24-bit unsigned integer.
UInt24(UInt32)Creates 24-bit unsigned integer from a 32-bit unsigned integer.
UInt24(Byte, Int32)Creates 24-bit unsigned integer from three bytes at a specified position in a byte array.

Methods

CompareTo(Object) Compares this instance to a specified object and returns an indication of their relative values.
CompareTo(UInt24) Compares this instance to a specified 24-bit unsigned integer and returns an indication of their relative values.
CompareTo(UInt32) Compares this instance to a specified 32-bit unsigned integer and returns an indication of their relative values.
Equals(Object) Returns a value indicating whether this instance is equal to a specified object.
(Overrides ValueTypeEquals(Object))
Equals(UInt24) Returns a value indicating whether this instance is equal to a specified UInt24 value.
Equals(UInt32) Returns a value indicating whether this instance is equal to a specified uint value.
GetBytesReturns the UInt24 value as an array of three bytes.
GetBytes(UInt24)Returns the specified UInt24 value as an array of three bytes.
GetHashCode Returns the hash code for this instance.
(Overrides ValueTypeGetHashCode)
GetTypeGets the Type of the current instance.
(Inherited from Object)
GetTypeCode Returns the System.TypeCode for value type System.UInt32 (there is no defined type code for an UInt24).
GetValueReturns a 24-bit unsigned integer from three bytes at a specified position in a byte array.
Parse(String) Converts the string representation of a number to its 24-bit unsigned integer equivalent.
Parse(String, NumberStyles) Converts the string representation of a number in a specified style to its 24-bit unsigned integer equivalent.
Parse(String, IFormatProvider) Converts the string representation of a number in a specified culture-specific format to its 24-bit unsigned integer equivalent.
Parse(String, NumberStyles, IFormatProvider) Converts the string representation of a number in a specified style and culture-specific format to its 24-bit unsigned integer equivalent.
ToString Converts the numeric value of this instance to its equivalent string representation.
(Overrides ValueTypeToString)
ToString(IFormatProvider) Converts the numeric value of this instance to its equivalent string representation using the specified culture-specific format information.
ToString(String) Converts the numeric value of this instance to its equivalent string representation, using the specified format.
ToString(String, IFormatProvider) Converts the numeric value of this instance to its equivalent string representation using the specified format and culture-specific format information.
TryParse(String, UInt24) Converts the string representation of a number to its 24-bit unsigned integer equivalent. A return value indicates whether the conversion succeeded or failed.
TryParse(String, NumberStyles, IFormatProvider, UInt24) Converts the string representation of a number in a specified style and culture-specific format to its 24-bit unsigned integer equivalent. A return value indicates whether the conversion succeeded or failed.

Operators

Addition(UInt24, UInt24) Returns computed sum of values.
Addition(UInt24, UInt32) Returns computed sum of values.
Addition(UInt32, UInt24) Returns computed sum of values.
BitwiseAnd(UInt24, UInt24) Returns logical bitwise AND of values.
BitwiseAnd(UInt24, UInt32) Returns logical bitwise AND of values.
BitwiseAnd(UInt32, UInt24) Returns logical bitwise AND of values.
BitwiseOr(UInt24, UInt24) Returns logical bitwise OR of values.
BitwiseOr(UInt24, UInt32) Returns logical bitwise OR of values.
BitwiseOr(UInt32, UInt24) Returns logical bitwise OR of values.
Decrement(UInt24) Returns decremented value.
Division(UInt24, UInt24) Returns computed division of values.
Division(UInt24, UInt32) Returns computed division of values.
Division(UInt32, UInt24) Returns computed division of values.
Equality(UInt24, UInt24) Compares the two values for equality.
Equality(UInt24, UInt32) Compares the two values for equality.
Equality(UInt32, UInt24) Compares the two values for equality.
ExclusiveOr(UInt24, UInt24) Returns logical bitwise exclusive-OR of values.
ExclusiveOr(UInt24, UInt32) Returns logical bitwise exclusive-OR of values.
ExclusiveOr(UInt32, UInt24) Returns logical bitwise exclusive-OR of values.
(Decimal to UInt24) Explicitly converts value to an UInt24.
(Double to UInt24) Explicitly converts value to an UInt24.
(Enum to UInt24) Explicitly converts value to an UInt24.
(Int24 to UInt24) Explicitly converts value to an UInt24.
(Single to UInt24) Explicitly converts value to an UInt24.
(String to UInt24) Explicitly converts value to an UInt24.
(UInt24 to Int24) Explicitly converts value to an Int24.
(UInt24 to Byte) Explicitly converts UInt24 to Byte.
(UInt24 to Int16) Explicitly converts UInt24 to Int16.
(UInt24 to UInt16) Explicitly converts UInt24 to UInt16.
(UInt32 to UInt24) Explicitly converts value to an UInt24.
(UInt64 to UInt24) Explicitly converts value to an UInt24.
Exponent(Int32, UInt24) Returns result of first value raised to power of second value.
Exponent(UInt24, UInt24) Returns result of first value raised to power of second value.
Exponent(UInt24, Int32) Returns result of first value raised to power of second value.
False(UInt24) Returns true if value is equal to zero.
GreaterThan(UInt24, UInt24) Returns true if left value is greater than right value.
GreaterThan(UInt24, UInt32) Returns true if left value is greater than right value.
GreaterThan(UInt32, UInt24) Returns true if left value is greater than right value.
GreaterThanOrEqual(UInt24, UInt24) Returns true if left value is greater than or equal to right value.
GreaterThanOrEqual(UInt24, UInt32) Returns true if left value is greater than or equal to right value.
GreaterThanOrEqual(UInt32, UInt24) Returns true if left value is greater than or equal to right value.
(Byte to UInt24) Implicitly converts value to an UInt24.
(Char to UInt24) Implicitly converts value to an UInt24.
(UInt16 to UInt24) Implicitly converts value to an UInt24.
(UInt24 to Decimal) Implicitly converts UInt24 to Decimal.
(UInt24 to Double) Implicitly converts UInt24 to Double.
(UInt24 to Int32) Implicitly converts UInt24 to Int32.
(UInt24 to Int64) Implicitly converts UInt24 to Int64.
(UInt24 to Single) Implicitly converts UInt24 to Single.
(UInt24 to String) Implicitly converts UInt24 to String.
(UInt24 to UInt32) Implicitly converts UInt24 to UInt32.
(UInt24 to UInt64) Implicitly converts UInt24 to UInt64.
Increment(UInt24) Returns incremented value.
Inequality(UInt24, UInt24) Compares the two values for inequality.
Inequality(UInt24, UInt32) Compares the two values for inequality.
Inequality(UInt32, UInt24) Compares the two values for inequality.
LeftShift(UInt24, Int32) Returns value after left shifts of first value by the number of bits specified by second value.
LessThan(UInt24, UInt24) Returns true if left value is less than right value.
LessThan(UInt24, UInt32) Returns true if left value is less than right value.
LessThan(UInt32, UInt24) Returns true if left value is less than right value.
LessThanOrEqual(UInt24, UInt24) Returns true if left value is less or equal to than right value.
LessThanOrEqual(UInt24, UInt32) Returns true if left value is less or equal to than right value.
LessThanOrEqual(UInt32, UInt24) Returns true if left value is less or equal to than right value.
Modulus(UInt24, UInt24) Returns computed remainder after dividing first value by the second.
Modulus(UInt24, UInt32) Returns computed remainder after dividing first value by the second.
Modulus(UInt32, UInt24) Returns computed remainder after dividing first value by the second.
Multiply(UInt24, UInt24) Returns computed product of values.
Multiply(UInt24, UInt32) Returns computed product of values.
Multiply(UInt32, UInt24) Returns computed product of values.
OnesComplement(UInt24) Returns bitwise complement of value.
RightShift(UInt24, Int32) Returns value after right shifts of first value by the number of bits specified by second value.
Subtraction(UInt24, UInt24) Returns computed difference of values.
Subtraction(UInt24, UInt32) Returns computed difference of values.
Subtraction(UInt32, UInt24) Returns computed difference of values.
True(UInt24) Returns true if value is greater than zero.

Fields

BitMaskHigh byte bit-mask used when a 24-bit integer is stored within a 32-bit integer. This field is constant.
MaxValue Represents the largest possible value of an Int24. This field is constant.
MinValue Represents the smallest possible value of an Int24. This field is constant.

Extension Methods

BitRotL Performs rightwise bit-rotation for the specified number of rotations.
(Defined by BitExtensions)
BitRotR Performs rightwise bit-rotation for the specified number of rotations.
(Defined by BitExtensions)
CheckBits Determines if specified bits are set.
(Defined by BitExtensions)
CheckBits Determines if specified bits are set.
(Defined by BitExtensions)
CheckBits Determines if specified bits are set.
(Defined by BitExtensions)
CheckBits Determines if specified bits are set.
(Defined by BitExtensions)
ClearBits Returns value with specified bits cleared.
(Defined by BitExtensions)
ClearBits Returns value with specified bits cleared.
(Defined by BitExtensions)
GetMaskedValue Returns value stored in the bits represented by the specified bitmask.
(Defined by BitExtensions)
GetMaskedValue Returns value stored in the bits represented by the specified bitmask.
(Defined by BitExtensions)
SetBits Returns value with specified bits set.
(Defined by BitExtensions)
SetBits Returns value with specified bits set.
(Defined by BitExtensions)
SetMaskedValue Returns value after setting a new value for the bits specified by the bitmask.
(Defined by BitExtensions)
SetMaskedValue Returns value after setting a new value for the bits specified by the bitmask.
(Defined by BitExtensions)
ToBinaryString Encodes value as binary, i.e., a string of bit values (0 or 1).
(Defined by BitExtensions)
ToggleBits Returns value with specified bits toggled.
(Defined by BitExtensions)
ToggleBits Returns value with specified bits toggled.
(Defined by BitExtensions)

See Also