Casts

#import Builtin.Casts;

A builtin module defining casts between all of the builtin types

Functions


float(int)

cast :: float(x : int)

Converts an int to float

float(char)

cast :: float(x : char)

Converts a char to float

float(float)

cast :: float(x : float)

Identity cast for float

float(double)

cast :: float(x : double)

Converts a double to float

float(bool)

cast :: float(x : bool)

Converts a bool to float

double(int)

cast :: double(x : int)

Converts an int to double

double(char)

cast :: double(x : char)

Converts a char to double

double(float)

cast :: double(x : float)

Converts a float to double

double(double)

cast :: double(x : double)

Identity cast for double

double(bool)

cast :: double(x : bool)

Converts a bool to double

int(float)

cast :: int(x : float)

Converts a float to int, truncating decimal portion

int(double)

cast :: int(x : double)

Converts a double to int, truncating decimal portion

int(int)

cast :: int(x : int)

Identity cast for int

int(uint)

cast :: int(x : uint)

Converts an unsigned int to signed int

int(bool)

cast :: int(x : bool)

Converts a bool to int

uint(float)

cast :: uint(x : float)

Converts a float to unsigned int, truncating decimal portion

uint(double)

cast :: uint(x : double)

Converts a double to unsigned int, truncating decimal portion

uint(int)

cast :: uint(x : int)

Converts a signed int to unsigned int

uint(uint)

cast :: uint(x : uint)

uint(bool)

cast :: uint(x : bool)

Converts a bool to unsigned int

uint64(float)

cast :: uint64(x : float)

Converts a float to 64-bit unsigned int

uint64(double)

cast :: uint64(x : double)

Converts a double to 64-bit unsigned int

uint64(int)

cast :: uint64(x : int)

Converts an int to 64-bit unsigned int

uint64(uint)

cast :: uint64(x : uint)

Converts an unsigned int to 64-bit unsigned int

uint64(bool)

cast :: uint64(x : bool)

Converts a bool to 64-bit unsigned int

int64(float)

cast :: int64(x : float)

Converts a float to 64-bit signed int

int64(double)

cast :: int64(x : double)

Converts a double to 64-bit signed int

int64(int)

cast :: int64(x : int)

Converts an int to 64-bit signed int

int64(uint)

cast :: int64(x : uint)

Converts an unsigned int to 64-bit signed int

int64(bool)

cast :: int64(x : bool)

Converts a bool to 64-bit signed int

uint16(float)

cast :: uint16(x : float)

Converts a float to 16-bit unsigned int

uint16(double)

cast :: uint16(x : double)

Converts a double to 16-bit unsigned int

uint16(int)

cast :: uint16(x : int)

Converts an int to 16-bit unsigned int

uint16(uint)

cast :: uint16(x : uint)

Converts an unsigned int to 16-bit unsigned int

uint16(bool)

cast :: uint16(x : bool)

Converts a bool to 16-bit unsigned int

uint8(float)

cast :: uint8(x : float)

Converts a float to 8-bit unsigned int

uint8(double)

cast :: uint8(x : double)

Converts a double to 8-bit unsigned int

uint8(int)

cast :: uint8(x : int)

Converts an int to 8-bit unsigned int

uint8(uint)

cast :: uint8(x : uint)

Converts an unsigned int to 8-bit unsigned int

uint8(bool)

cast :: uint8(x : bool)

Converts a bool to 8-bit unsigned int

char(int)

cast :: char(x : int)

Converts an int to char (truncates to 8 bits)

char(int64)

cast :: char(x : int64)

Converts an int64 to char (truncates to 8 bits)

char(int16)

cast :: char(x : int16)

Converts an int16 to char (truncates to 8 bits)

char(uint)

cast :: char(x : uint)

Converts a uint to char (truncates to 8 bits)

int(int64)

cast :: int(x : int64)

Converts an int64 to int (truncates to 32 bits)

uint64(int64)

cast :: uint64(x : int64)

Reinterprets an int64 as uint64

int64(uint64)

cast :: int64(x : uint64)

Reinterprets a uint64 as int64

int64(*char)

cast :: int64(x : *char)

Converts a *char pointer to int64