value · System
Int32
public value Int32 : ISignedNumber<i32>, IHashable<i32>, IComparable<i32>, IToString
- Kind
- value
- Namespace
- System
- Assembly
- System.Core
- Access
- public, members of i32
- Source file
Primitives.ant
Inheritance
- Interfaces
-
ISignedNumber<TSelf>IHashable<TSelf>IComparable<TSelf>IToString - All interfaces
-
IComparable<TSelf>IHashable<TSelf>INumber<TSelf>ISignedNumber<TSelf>IToString
Properties
Methods
ToString(str format) : str
#
As text by a format: D, X, B, N, F, E, P, G and a precision (255.ToString("X4") is "00FF").
ToString() : str
#
The number text writes, or null when it writes none.
Constants
The smallest i32.
The largest i32.
Source
Int32 as Antril, decompiled from its Larva HIR.
// System.Int32 — System.Core (decompiled from Larva HIR)
into namespace System
{
[Primitive("i32")]
public value Int32 : ISignedNumber<i32>, IHashable<i32>, IComparable<i32>, IToString
{
public:
/// The smallest i32.
const i32 MinValue = -2147483648;
/// The largest i32.
const i32 MaxValue = 2147483647;
[Inline]
static FromF64(f64 value) : i32 => (i32)value;
[Inline]
static ToF64(i32 value) : f64 => value;
/// As text by a format: D, X, B, N, F, E, P, G and a precision (`255.ToString("X4")` is "00FF").
ToString(str format) : str => NumberFormat.FormatInteger((u32)this, 32, true, format);
ToString() : str => Number.Format(this);
Hash() : u64 => (u32)this;
Equals(i32 other) : bool => this == other;
CompareTo(i32 other) : i32 => this < other ? -1 : this > other ? 1 : 0;
static Parse(str text) : i32
{
i32? value = TryParse(text);
if (value == null)
throw new FormatError("not an i32: " + text);
return value.Value;
}
/// The number `text` writes, or null when it writes none.
static TryParse(str text) : i32?
{
i64? value = Number.TryParse(text);
if (value == null || value.Value < -2147483648 || value.Value > 2147483647)
return null;
return (i32)value.Value;
}
static i32 Zero
{
get => 0;
}
static i32 One
{
get => 1;
}
static i32 NegativeOne
{
get => -1;
}
}
}