value · System

Int32

public value Int32 : ISignedNumber<i32>, IHashable<i32>, IComparable<i32>, IToString
Tipo
value
Espacio de nombres
System
Ensamblado
System.Core
Acceso
public, miembros de i32
Archivo fuente
Primitives.ant

Herencia

Interfaces
ISignedNumber<TSelf> IHashable<TSelf> IComparable<TSelf> IToString
Todas las interfaces
IComparable<TSelf> IHashable<TSelf> INumber<TSelf> ISignedNumber<TSelf> IToString

Propiedades

static i32 Zero { get; }
#

static read-only

static i32 One { get; }
#

static read-only

static i32 NegativeOne { get; }
#

static read-only

Métodos

static FromF64(f64 value) : i32
#

static

static ToF64(i32 value) : f64
#

static

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
#
Hash() : u64
#
Equals(i32 other) : bool
#
CompareTo(i32 other) : i32
#
static Parse(str text) : i32
#

static

static TryParse(str text) : i32?
#

static

The number text writes, or null when it writes none.

Constantes

const i32 MinValue = -2147483648
#

The smallest i32.

const i32 MaxValue = 2147483647
#

The largest i32.

Código fuente

Int32 en Antril, descompilado a partir de su Larva HIR.

System.Int32.ant
// 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;
			}
	}
}
Esc