namespace sys.core.lang
class PtrSize
A class representing a size of a pointer or an offset withing a pointer.
It is an unsigned value. It can be 32 or 64 bits long, depending on the target architecture.
It maps exactly to a 32/64 bit CPU resource and has no overhead. Because of this strict mapping it can't have extra non-static member variables, can't be inherited from and can't have virtual methods.
def Clamp(min: PtrSize, max: PtrSize);
Clamps the current mutable instance between `min` and `max`.
min | the minimum value |
---|---|
max | the maximum value |
func Clamped(min: PtrSize, max: PtrSize): PtrSize;
Returns the current instance clamped between `min` and `max`.
min | the minimum value |
---|---|
max | the maximum value |
the clamped value
func @write(ref stream: Stream);
func @write(ref stream: Stream, format: OutputFormat);
Writes the value to an Utf8 text stream.
Can use an optional output format specifier.
stream | the output stream |
---|---|
format | formatting information |
func @put(ref stream: Stream);
Writes the value to a binary stream as a 32/64 bit unsigned integer.
stream | the output stream |
---|
def @get(ref stream: Stream);
Reads a 32/64 bit unsigned integer from a binary stream.
stream | the input stream |
---|
property Abs: PtrSize; get;
Returns the absolute value.
In the case of PtrSize it returns the value itself and is included only for API compatibility when using templates.
property Sqr: PtrSize; get;
Returns the square of the value value.
property Sqrt: PtrSize; get;
Returns the square root of the value, rounded down.
property Floor: PtrSize; get;
Returns the floor of a floating point value.
In the case of PtrSize it returns the value itself and is included only for API compatibility when using templates.
property Ceil: PtrSize; get;
Returns the ceiling of a floating point value.
In the case of PtrSize it returns the value itself and is included only for API compatibility when using templates.
property Round: PtrSize; get;
Returns the rounded value of a floating point.
In the case of PtrSize it returns the value itself and is included only for API compatibility when using templates.
const Zero: PtrSize;
A PtrSize instance representing a logical "0" value.
const One: PtrSize;
A PtrSize instance representing a logical "1" value.
const Min: PtrSize;
The minimum value for a PtrSize (32/64 bit unsigned integer) instance.
const Max: PtrSize;
The minimum value for a PtrSize (64 bit signed integer) instance.
const Invalid: PtrSize;
The value signaling invalid/out of bounds.
const IsSigned;
true if the numeric representation uses two's complement signed values, false otherwise.
const IsInteger;
true if the numeric representation is an integer, false if it is a floating point.
const MaxDigitsLow;
The lower limit for the number of base 10 digits that are needed to represent a maximal value in textual form.
In base 10, you can have MaxDigitsLow digits that go though values 0-9.
Should not be used for buffer sizes.
const MaxDigitsHigh;
The upper limit for the number of base 10 digits that are needed to represent a maximal value in textual form.
In base 10, the `MaxDigitsHigh - MaxDigitsLow` most significant digits can't go though values 0-9 because they do not fit the binary representation.
Should not be used for buffer sizes.