package base:intrinsics

⌘K
Ctrl+K
or
/

    Overview

    package intrinsics provides documentation for Odin's compiler-level intrinsics.

    Index

    Constants (0)

    This section is empty.

    Procedures (192)
    Procedure Groups (0)

    This section is empty.

    Constants

    Types

    Atomic_Memory_Order ¶

    Atomic_Memory_Order :: enum {
    	Relaxed = 0, // Unordered
    	Consume = 1, // Monotonic
    	Acquire = 2,
    	Release = 3,
    	Acq_Rel = 4,
    	Seq_Cst = 5,
    }
     

    An enumeration of atomic memory orderings used by the atomic_*_explicit intrinsics that determines which atomic instructions on the same address they synchronize with.This follows the same memory model as C11/C++11.

    objc_object ¶

    objc_object :: struct {}
     

    Darwin targets only Represents an Objective-C object type.

    objc_selector ¶

    objc_selector :: struct {}
     

    Darwin targets only Represents an Objective-C selector type.

    objc_class ¶

    objc_class :: struct {}
     

    Darwin targets only Represents an Objective-C class type.

    objc_id ¶

    objc_id :: ^objc_object
     

    Darwin targets only Represents an Objective-C id type.

    objc_SEL ¶

    objc_SEL :: ^objc_selector
     

    Darwin targets only Represents an Objective-C SEL type.

    objc_Class ¶

    objc_Class :: ^objc_class
     

    Darwin targets only Represents an Objective-C Class type.

    Procedures

    soa_struct ¶

    soa_struct :: proc($N: int, $T: typeid) -> type/#soa[N]T {…}
     

    A call-like way to construct an #soa struct. Possibly to be deprecated in the future.

    volatile_load ¶

    volatile_load :: proc(dst: ^$T) -> T {…}
     

    Tells the optimizing backend of a compiler to not change the number of 'volatile' operations nor change their order of execution relative to other 'volatile' operations. Optimizers are allowed to change the order of volatile operations relative to non-volatile operations.

    NOTE: This has nothing to do with Java's 'volatile' and has no cross-thread synchronization behaviour. Use atomics if this behaviour is wanted.

    volatile_store ¶

    volatile_store :: proc(dst: ^$T, val: T) {…}
     

    Tells the optimizing backend of a compiler to not change the number of 'volatile' operations nor change their order of execution relative to other 'volatile' operations. Optimizers are allowed to change the order of volatile operations relative to non-volatile operations.

    NOTE: This has nothing to do with Java's 'volatile' and has no cross-thread synchronization behaviour. Use atomics if this behaviour is wanted.

    non_temporal_load ¶

    non_temporal_load :: proc(dst: ^$T) -> T {…}
     

    Tells the code generator of a compiler that this operation is not expected to be reused in the cache. The code generator may select special instructions to save cache bandwidth (e.g. on x86, movnt instruct might be used).

    non_temporal_store ¶

    non_temporal_store :: proc(dst: ^$T, val: T) {…}
     

    Tells the code generator of a compiler that this operation is not expected to be reused in the cache. The code generator may select special instructions to save cache bandwidth (e.g. on x86, movnt instruct might be used).

    debug_trap ¶

    debug_trap :: proc() {…}
     

    A call intended to cause an execution trap with the intention of requesting a debugger's attention.

    trap ¶

    trap :: proc() -> ! {…}
     

    Lowered to a target dependent trap instruction.

    alloca ¶

    alloca :: proc(size, align: int) -> [^]u8 {…}
     

    A procedure that allocates size bytes of space in the stack frame of the caller, aligned to align bytes. This temporary space is automatically freed when the procedure that called alloca returns to its caller.

    cpu_relax ¶

    cpu_relax :: proc() {…}
     

    On i386/amd64, it should map to the pause instruction. On arm64, it should map to isb instruction (see https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8258604 for more information).

    read_cycle_counter ¶

    read_cycle_counter :: proc() -> i64 {…}
     

    This provides access to the cycle counter register (or similar low latency, high accuracy clocks) on the targets that support it. On i386/amd64, it should map to the rdtsc instruction. On arm64, it should map to the cntvct_el0 instruction.

    count_ones ¶

    count_ones :: proc(x: $T) -> T where type_is_integer(T) || type_is_simd_vector(T) {…}
     

    Counts the number of set bits (1s).

    count_zeros ¶

    count_zeros :: proc(x: $T) -> T where type_is_integer(T) || type_is_simd_vector(T) {…}
     

    Counts the number of unset bits (0s).

    count_trailing_zeros ¶

    count_trailing_zeros :: proc(x: $T) -> T where type_is_integer(T) || type_is_simd_vector(T) {…}
     

    Counts the number of trailing unset bits (0s) until a set bit (1)` is seen or if at all.

    count_leading_zeros ¶

    count_leading_zeros :: proc(x: $T) -> T where type_is_integer(T) || type_is_simd_vector(T) {…}
     

    Counts the number of leading unset bits (0s) until a set bit (1)` is seen or if at all.

    reverse_bits ¶

    reverse_bits :: proc(x: $T) -> T where type_is_integer(T) || type_is_simd_vector(T) {…}
     

    Reverses the bits from ascending order to descending order e.g. 0b01110101 -> 0b10101110

    byte_swap ¶

    byte_swap :: proc(x: $T) -> T where type_is_integer(T) || type_is_float(T) {…}
     

    Reverses the bytes from ascending order to descending order e.g. 0xfe_ed_01_12 -> `0x12_01_ed_fe

    overflow_add ¶

    overflow_add :: proc(lhs, rhs: $T) -> (T, bool) #optional_ok {…}
     

    Performs an "add" operation with an overflow check. The second return value will be true if an overflow occurs.

    overflow_sub ¶

    overflow_sub :: proc(lhs, rhs: $T) -> (T, bool) #optional_ok {…}
     

    Performs an "multiply" operation with an overflow check. The second return value will be true if an overflow occurs.

    overflow_mul ¶

    overflow_mul :: proc(lhs, rhs: $T) -> (T, bool) #optional_ok {…}
     

    Performs an "subtract" operation with an overflow check. The second return value will be true if an overflow occurs.

    sqrt ¶

    sqrt :: proc(x: $T) -> T where type_is_float(T) || (type_is_simd_vector(T) && type_is_float(type_elem_type(T))) {…}
     

    Returns the square root of a value. If the input value is negative, this is platform defined behaviour.

    fused_mul_add ¶

    fused_mul_add :: proc(a, b, c: $T) -> T where type_is_float(T) || (type_is_simd_vector(T) && type_is_float(type_elem_type(T))) {…}

    mem_copy ¶

    mem_copy :: proc(dst, src: rawptr, len: int) {…}
     

    Copies a block of memory from the src location to the dst location but assumes that the memory ranges could be overlapping. It is equivalent to C's memmove, but unlike the C's libc procedure, it does not return value.

    mem_copy_non_overlapping ¶

    mem_copy_non_overlapping :: proc(dst, src: rawptr, len: int) {…}
     

    Copies a block of memory from the src location to the dst location but it does not assume the memory ranges could be overlapping. It is equivalent to C's memcpy, but unlike the C's libc procedure, it does not return value.

    mem_zero ¶

    mem_zero :: proc(ptr: rawptr, len: int) {…}
     

    Zeroes a block of memory at the ptr location for len bytes.

    mem_zero_volatile ¶

    mem_zero_volatile :: proc(ptr: rawptr, len: int) {…}
     

    Zeroes a block of memory at the ptr location for len bytes with volatile semantics.

    ptr_offset ¶

    ptr_offset :: proc(ptr: ^$T, offset: int) -> ^T {…}
     

    Prefer using [^]T operations if possible. e.g. ptr[offset:]

    ptr_sub ¶

    ptr_sub :: proc(a, b: ^$T) -> int {…}
     

    Equivalent to int(uintptr(a) - uintptr(b)) / size_of(T)

    unaligned_load ¶

    unaligned_load :: proc(src: ^$T) -> T {…}
     

    Performs a load on an unaligned value src.

    unaligned_store ¶

    unaligned_store :: proc(dst: ^$T, val: T) -> T {…}
     

    Performs a store on an unaligned value dst.

    fixed_point_mul ¶

    fixed_point_mul :: proc(lhs, rhs: $T, #const scale: uint) -> T where type_is_integer(T) {…}
     

    A fixed point number represents a real data type for a number that has a fixed number of digits after a radix point. The number of digits after the radix point is referred to as scale.

    fixed_point_div ¶

    fixed_point_div :: proc(lhs, rhs: $T, #const scale: uint) -> T where type_is_integer(T) {…}
     

    A fixed point number represents a real data type for a number that has a fixed number of digits after a radix point. The number of digits after the radix point is referred to as scale.

    fixed_point_mul_sat ¶

    fixed_point_mul_sat :: proc(lhs, rhs: $T, #const scale: uint) -> T where type_is_integer(T) {…}
     

    A fixed point number represents a real data type for a number that has a fixed number of digits after a radix point. The number of digits after the radix point is referred to as scale.

    fixed_point_div_sat ¶

    fixed_point_div_sat :: proc(lhs, rhs: $T, #const scale: uint) -> T where type_is_integer(T) {…}
     

    A fixed point number represents a real data type for a number that has a fixed number of digits after a radix point. The number of digits after the radix point is referred to as scale.

    prefetch_read_instruction ¶

    prefetch_read_instruction :: proc(address: rawptr, #const locality: i32 /* 0..=3 */) {…}
     

    The prefetch_read_instruction intrinsic is a hint to the code gnerator to insert a prefetch instruction if supported; otherwise, it is a no-op. Prefetches have no affect on the behaviour of the program but can change its performance characteristics.

    The locality parameter must be a constant integer, and its temporal locality value ranges from 0 (no locality) to 3 (extremely local, keep in cache).

    prefetch_read_data ¶

    prefetch_read_data :: proc(address: rawptr, #const locality: i32 /* 0..=3 */) {…}
     

    The prefetch_read_instruction intrinsic is a hint to the code gnerator to insert a prefetch instruction if supported; otherwise, it is a no-op. Prefetches have no affect on the behaviour of the program but can change its performance characteristics.

    The locality parameter must be a constant integer, and its temporal locality value ranges from 0 (no locality) to 3 (extremely local, keep in cache).

    prefetch_write_instruction ¶

    prefetch_write_instruction :: proc(address: rawptr, #const locality: i32 /* 0..=3 */) {…}
     

    The prefetch_read_instruction intrinsic is a hint to the code gnerator to insert a prefetch instruction if supported; otherwise, it is a no-op. Prefetches have no affect on the behaviour of the program but can change its performance characteristics.

    The locality parameter must be a constant integer, and its temporal locality value ranges from 0 (no locality) to 3 (extremely local, keep in cache).

    prefetch_write_data ¶

    prefetch_write_data :: proc(address: rawptr, #const locality: i32 /* 0..=3 */) {…}
     

    The prefetch_read_instruction intrinsic is a hint to the code gnerator to insert a prefetch instruction if supported; otherwise, it is a no-op. Prefetches have no affect on the behaviour of the program but can change its performance characteristics.

    The locality parameter must be a constant integer, and its temporal locality value ranges from 0 (no locality) to 3 (extremely local, keep in cache).

    constant_utf16_cstring ¶

    constant_utf16_cstring :: proc($literal: string) -> [^]u16 {…}
     

    Returns a run-time value of a constant string UTF-8 value encoded as a UTF-16 NUL terminated string value, useful for interfacing with UTF-16 procedure such as the Windows API.

    transpose ¶

    transpose :: proc(m: $M/matrix[$R, $C]$E) -> matrix[C, R]E {…}

    outer_product ¶

    outer_product :: proc(a: $A/[$I]$E, b: $B/[$J]E) -> (c: [I*J]E) {…}

    hadamard_product ¶

    hadamard_product :: proc(a, b: $M/matrix[$R, $C]$E) -> (c: M) {…}

    matrix_flatten ¶

    matrix_flatten :: proc(m: $M/matrix[$R, $C]$E) -> [R*C]E {…}

    expect ¶

    expect :: proc(val, expected_val: T) -> T {…}
     

    Provides information about expected (the most probable) value of val, which can be used by optimizing backends.

    syscall ¶

    syscall :: proc(id: uintptr, args: ..uintptr) -> uintptr {…}
     

    Linux and Darwin Only

    atomic_type_is_lock_free ¶

    atomic_type_is_lock_free :: proc($T: typeid) -> bool {…}

    atomic_thread_fence ¶

    atomic_thread_fence :: proc(order: Atomic_Memory_Order) {…}
     

    Adds a "fence" to introduce a "happens-before" edges between operations.

    atomic_signal_fence ¶

    atomic_signal_fence :: proc(order: Atomic_Memory_Order) {…}
     

    Adds a "fence" to introduce a "happens-before" edges between operations.

    atomic_store ¶

    atomic_store :: proc(dst: ^$T, val: T) {…}

    atomic_store_explicit ¶

    atomic_store_explicit :: proc(dst: ^$T, val: T, order: Atomic_Memory_Order) {…}

    atomic_load ¶

    atomic_load :: proc(dst: ^$T) -> T {…}

    atomic_load_explicit ¶

    atomic_load_explicit :: proc(dst: ^$T, order: Atomic_Memory_Order) -> T {…}

    atomic_add ¶

    atomic_add :: proc(dst: ^$T, val: T) -> T {…}

    atomic_add_explicit ¶

    atomic_add_explicit :: proc(dst: ^$T, val: T, order: Atomic_Memory_Order) -> T {…}

    atomic_sub ¶

    atomic_sub :: proc(dst: ^$T, val: T) -> T {…}

    atomic_sub_explicit ¶

    atomic_sub_explicit :: proc(dst: ^$T, val: T, order: Atomic_Memory_Order) -> T {…}

    atomic_and ¶

    atomic_and :: proc(dst: ^$T, val: T) -> T {…}

    atomic_and_explicit ¶

    atomic_and_explicit :: proc(dst: ^$T, val: T, order: Atomic_Memory_Order) -> T {…}

    atomic_nand ¶

    atomic_nand :: proc(dst: ^$T, val: T) -> T {…}

    atomic_nand_explicit ¶

    atomic_nand_explicit :: proc(dst: ^$T, val: T, order: Atomic_Memory_Order) -> T {…}

    atomic_or ¶

    atomic_or :: proc(dst: ^$T, val: T) -> T {…}

    atomic_or_explicit ¶

    atomic_or_explicit :: proc(dst: ^$T, val: T, order: Atomic_Memory_Order) -> T {…}

    atomic_xor ¶

    atomic_xor :: proc(dst: ^$T, val: T) -> T {…}

    atomic_xor_explicit ¶

    atomic_xor_explicit :: proc(dst: ^$T, val: T, order: Atomic_Memory_Order) -> T {…}

    atomic_exchange ¶

    atomic_exchange :: proc(dst: ^$T, val: T) -> T {…}

    atomic_exchange_explicit ¶

    atomic_exchange_explicit :: proc(dst: ^$T, val: T, order: Atomic_Memory_Order) -> T {…}

    atomic_compare_exchange_strong ¶

    atomic_compare_exchange_strong :: proc(dst: ^$T, old, new: T) -> (T, bool) #optional_ok {…}

    atomic_compare_exchange_strong_explicit ¶

    atomic_compare_exchange_strong_explicit :: proc(dst: ^$T, old, new: T, success, failure: Atomic_Memory_Order) -> (T, bool) #optional_ok {…}

    atomic_compare_exchange_weak ¶

    atomic_compare_exchange_weak :: proc(dst: ^$T, old, new: T) -> (T, bool) #optional_ok {…}

    atomic_compare_exchange_weak_explicit ¶

    atomic_compare_exchange_weak_explicit :: proc(dst: ^$T, old, new: T, success, failure: Atomic_Memory_Order) -> (T, bool) #optional_ok {…}

    type_base_type ¶

    type_base_type :: proc($T: typeid) -> type {…}
     

    Returns the type without any distinct indirection e.g. Foo :: distinct int, type_base_type(Foo) == int

    type_core_type ¶

    type_core_type :: proc($T: typeid) -> type {…}
     

    Returns the type without any distinct indirection and the underlying integer type for an enum e.g. Foo :: distinct int, type_core_type(Foo) == int, or Bar :: enum u8 {A}, type_core_type(Bar) == u8

    type_elem_type ¶

    type_elem_type :: proc($T: typeid) -> type {…}
     

    Returns the element type of an compound type.

    Complex number: the underlying float type (e.g. complex64 -> f32) Quaternion: the underlying float type (e.g. quaternion256 -> f64) Pointer: the base type (e.g. ^T -> T) Array: the element type (e.g. [N]T -> T) Enumerated Array: the element type (e.g. [Enum]T -> T) Slice: the element type (e.g. []T -> T) Dynamic Array: the element type (e.g. [dynamic]T -> T)

    type_is_boolean ¶

    type_is_boolean :: proc($T: typeid) -> bool {…}

    type_is_integer ¶

    type_is_integer :: proc($T: typeid) -> bool {…}

    type_is_rune ¶

    type_is_rune :: proc($T: typeid) -> bool {…}

    type_is_float ¶

    type_is_float :: proc($T: typeid) -> bool {…}

    type_is_complex ¶

    type_is_complex :: proc($T: typeid) -> bool {…}

    type_is_quaternion ¶

    type_is_quaternion :: proc($T: typeid) -> bool {…}

    type_is_string ¶

    type_is_string :: proc($T: typeid) -> bool {…}

    type_is_typeid ¶

    type_is_typeid :: proc($T: typeid) -> bool {…}

    type_is_any ¶

    type_is_any :: proc($T: typeid) -> bool {…}

    type_is_endian_platform ¶

    type_is_endian_platform :: proc($T: typeid) -> bool {…}

    type_is_endian_little ¶

    type_is_endian_little :: proc($T: typeid) -> bool {…}

    type_is_endian_big ¶

    type_is_endian_big :: proc($T: typeid) -> bool {…}

    type_is_unsigned ¶

    type_is_unsigned :: proc($T: typeid) -> bool {…}
     

    Returns true if a "numeric" in nature:

    Any integer Any float Any complex number Any quaternion Any enum Any fixed-array of a numeric type

    type_is_numeric ¶

    type_is_numeric :: proc($T: typeid) -> bool {…}

    type_is_ordered ¶

    type_is_ordered :: proc($T: typeid) -> bool {…}

    type_is_ordered_numeric ¶

    type_is_ordered_numeric :: proc($T: typeid) -> bool {…}

    type_is_indexable ¶

    type_is_indexable :: proc($T: typeid) -> bool {…}

    type_is_sliceable ¶

    type_is_sliceable :: proc($T: typeid) -> bool {…}

    type_is_comparable ¶

    type_is_comparable :: proc($T: typeid) -> bool {…}
     

    Returns true if the type is comparable, which allows for the use of == and != binary operators.

    One of the following non-compound types (as well as any distinct forms): rune, string, cstring, typeid, pointer, #soa related pointer, multi-pointer, enum, procedure, matrix, bit_set, #simd vector.

    One of the following compound types (as well as any distinct forms): any array or enumerated array where its element type is also comparable; any struct where all of its fields are comparable; any struct #raw_union were all of its fields are simply comparable (see type_is_simple_compare); any union where all of its variants are comparable.

    type_is_simple_compare ¶

    type_is_simple_compare :: proc($T: typeid) -> bool {…}
     

    easily compared using memcmp (== and !=)

    type_is_dereferenceable ¶

    type_is_dereferenceable :: proc($T: typeid) -> bool {…}
     

    Must be a pointer type ^T (not rawptr) or an #soa related pointer type.

    type_is_valid_map_key ¶

    type_is_valid_map_key :: proc($T: typeid) -> bool {…}
     

    Any comparable type which is not-untyped nor generic.

    type_is_valid_matrix_elements ¶

    type_is_valid_matrix_elements :: proc($T: typeid) -> bool {…}
     

    Any integer, float, or complex number type (not-untyped).

    type_is_named ¶

    type_is_named :: proc($T: typeid) -> bool {…}

    type_is_pointer ¶

    type_is_pointer :: proc($T: typeid) -> bool {…}

    type_is_multi_pointer ¶

    type_is_multi_pointer :: proc($T: typeid) -> bool {…}

    type_is_array ¶

    type_is_array :: proc($T: typeid) -> bool {…}

    type_is_enumerated_array ¶

    type_is_enumerated_array :: proc($T: typeid) -> bool {…}

    type_is_slice ¶

    type_is_slice :: proc($T: typeid) -> bool {…}

    type_is_dynamic_array ¶

    type_is_dynamic_array :: proc($T: typeid) -> bool {…}

    type_is_map ¶

    type_is_map :: proc($T: typeid) -> bool {…}

    type_is_struct ¶

    type_is_struct :: proc($T: typeid) -> bool {…}

    type_is_union ¶

    type_is_union :: proc($T: typeid) -> bool {…}

    type_is_enum ¶

    type_is_enum :: proc($T: typeid) -> bool {…}

    type_is_proc ¶

    type_is_proc :: proc($T: typeid) -> bool {…}

    type_is_bit_set ¶

    type_is_bit_set :: proc($T: typeid) -> bool {…}

    type_is_simd_vector ¶

    type_is_simd_vector :: proc($T: typeid) -> bool {…}

    type_is_matrix ¶

    type_is_matrix :: proc($T: typeid) -> bool {…}

    type_has_nil ¶

    type_has_nil :: proc($T: typeid) -> bool {…}
     

    Types that support nil:

    rawptr any cstring typeid enum bit_set Slices proc values Pointers #soa Pointers Multi-Pointers Dynamic Arrays map union without the #no_nil directive #soa slices #soa dynamic arrays

    type_is_specialization_of ¶

    type_is_specialization_of :: proc($T, $S: typeid) -> bool {…}

    type_is_variant_of ¶

    type_is_variant_of :: proc($U, $V: typeid) -> bool where type_is_union(U) {…}

    type_union_tag_type ¶

    type_union_tag_type :: proc($T: typeid) -> typeid where type_is_union(T) {…}

    type_union_tag_offset ¶

    type_union_tag_offset :: proc($T: typeid) -> uintptr where type_is_union(T) {…}

    type_union_base_tag_value ¶

    type_union_base_tag_value :: proc($T: typeid) -> int where type_is_union(U) {…}

    type_union_variant_count ¶

    type_union_variant_count :: proc($T: typeid) -> int where type_is_union(T) {…}

    type_variant_type_of ¶

    type_variant_type_of :: proc($T: typeid, $index: int) -> typeid where type_is_union(T) {…}

    type_variant_index_of ¶

    type_variant_index_of :: proc($U, $V: typeid) -> int where type_is_union(U) {…}

    type_has_field ¶

    type_has_field :: proc($T: typeid, $name: string) -> bool {…}

    type_field_type ¶

    type_field_type :: proc($T: typeid, $name: string) -> typeid {…}

    type_proc_parameter_count ¶

    type_proc_parameter_count :: proc($T: typeid) -> int where type_is_proc(T) {…}

    type_proc_return_count ¶

    type_proc_return_count :: proc($T: typeid) -> int where type_is_proc(T) {…}

    type_proc_parameter_type ¶

    type_proc_parameter_type :: proc($T: typeid, index: int) -> typeid where type_is_proc(T) {…}

    type_proc_return_type ¶

    type_proc_return_type :: proc($T: typeid, index: int) -> typeid where type_is_proc(T) {…}

    type_struct_field_count ¶

    type_struct_field_count :: proc($T: typeid) -> int where type_is_struct(T) {…}

    type_polymorphic_record_parameter_count ¶

    type_polymorphic_record_parameter_count :: proc($T: typeid) -> typeid {…}

    type_polymorphic_record_parameter_value ¶

    type_polymorphic_record_parameter_value :: proc($T: typeid, index: int) -> $V {…}

    type_is_specialized_polymorphic_record ¶

    type_is_specialized_polymorphic_record :: proc($T: typeid) -> bool {…}

    type_is_unspecialized_polymorphic_record ¶

    type_is_unspecialized_polymorphic_record :: proc($T: typeid) -> bool {…}

    type_is_subtype_of ¶

    type_is_subtype_of :: proc($T, $U: typeid) -> bool {…}

    type_field_index_of ¶

    type_field_index_of :: proc($T: typeid, $name: string) -> uintptr {…}

    type_equal_proc ¶

    type_equal_proc :: proc($T: typeid) -> (equal:  proc "contextless" (rawptr, rawptr) -> bool)                 where type_is_comparable(T) {…}
     

    Returns the underlying procedure that is used to compare pointers to two values of the same time together. This is used by the map type and general complicated comparisons.

    type_hasher_proc ¶

    type_hasher_proc :: proc($T: typeid) -> (hasher: proc "contextless" (data: rawptr, seed: uintptr) -> uintptr) where type_is_comparable(T) {…}
     

    Returns the underlying procedure that is used to hash a pointer to a value used by the map type.

    type_map_info ¶

    type_map_info :: proc($T: typeid/map[$K]$V) -> ^runtime.Map_Info {…}

    type_map_cell_info ¶

    type_map_cell_info :: proc($T: typeid) -> ^runtime.Map_Cell_Info {…}

    type_convert_variants_to_pointers ¶

    type_convert_variants_to_pointers :: proc($T: typeid) -> typeid where type_is_union(T) {…}
     

    Returns a type which converts all of the variants of a union to be pointer types of those variants.

    Example:
    Foo :: union {A, B, C}
    type_convert_variants_to_pointers(Foo) == union {^A, ^B, ^C}
    

    type_merge ¶

    type_merge :: proc($U, $V: typeid) -> typeid where type_is_union(U), type_is_union(V) {…}

    simd_add ¶

    simd_add :: proc(a, b: #simd[N]T) -> #simd[N]T {…}

    simd_sub ¶

    simd_sub :: proc(a, b: #simd[N]T) -> #simd[N]T {…}

    simd_mul ¶

    simd_mul :: proc(a, b: #simd[N]T) -> #simd[N]T {…}

    simd_div ¶

    simd_div :: proc(a, b: #simd[N]T) -> #simd[N]T where type_is_float(T) {…}

    simd_shl ¶

    simd_shl :: proc(a: #simd[N]T, b: #simd[N]Unsigned_Integer) -> #simd[N]T {…}
     

    Keeps Odin's behaviour: (x << y) if y <= mask else 0

    simd_shr ¶

    simd_shr :: proc(a: #simd[N]T, b: #simd[N]Unsigned_Integer) -> #simd[N]T {…}
     

    Keeps Odin's behaviour: `(x >> y) if y <= mask else 0

    simd_shl_masked ¶

    simd_shl_masked :: proc(a: #simd[N]T, b: #simd[N]Unsigned_Integer) -> #simd[N]T {…}
     

    Similar to C's behaviour: x << (y & mask)

    simd_shr_masked ¶

    simd_shr_masked :: proc(a: #simd[N]T, b: #simd[N]Unsigned_Integer) -> #simd[N]T {…}
     

    Similar to C's behaviour: `x >> (y & mask)

    simd_add_sat ¶

    simd_add_sat :: proc(a, b: #simd[N]T) -> #simd[N]T {…}

    simd_sub_sat ¶

    simd_sub_sat :: proc(a, b: #simd[N]T) -> #simd[N]T {…}

    simd_bit_and ¶

    simd_bit_and :: proc(a, b: #simd[N]T) -> #simd[N]T {…}

    simd_bit_or ¶

    simd_bit_or :: proc(a, b: #simd[N]T) -> #simd[N]T {…}

    simd_bit_xor ¶

    simd_bit_xor :: proc(a, b: #simd[N]T) -> #simd[N]T {…}

    simd_bit_and_not ¶

    simd_bit_and_not :: proc(a, b: #simd[N]T) -> #simd[N]T {…}

    simd_neg ¶

    simd_neg :: proc(a: #simd[N]T) -> #simd[N]T {…}

    simd_abs ¶

    simd_abs :: proc(a: #simd[N]T) -> #simd[N]T {…}

    simd_min ¶

    simd_min :: proc(a, b: #simd[N]T) -> #simd[N]T {…}

    simd_max ¶

    simd_max :: proc(a, b: #simd[N]T) -> #simd[N]T {…}

    simd_clamp ¶

    simd_clamp :: proc(v, min, max: #simd[N]T) -> #simd[N]T {…}

    simd_lanes_eq ¶

    simd_lanes_eq :: proc(a, b: #simd[N]T) -> #simd[N]Integer {…}
     

    Return an unsigned integer of the same size as the input type, NOT A BOOLEAN. element-wise: false => 0x00...00, true => 0xff...ff

    simd_lanes_ne ¶

    simd_lanes_ne :: proc(a, b: #simd[N]T) -> #simd[N]Integer {…}
     

    Return an unsigned integer of the same size as the input type, NOT A BOOLEAN. element-wise: false => 0x00...00, true => 0xff...ff

    simd_lanes_lt ¶

    simd_lanes_lt :: proc(a, b: #simd[N]T) -> #simd[N]Integer {…}
     

    Return an unsigned integer of the same size as the input type, NOT A BOOLEAN. element-wise: false => 0x00...00, true => 0xff...ff

    simd_lanes_le ¶

    simd_lanes_le :: proc(a, b: #simd[N]T) -> #simd[N]Integer {…}
     

    Return an unsigned integer of the same size as the input type, NOT A BOOLEAN. element-wise: false => 0x00...00, true => 0xff...ff

    simd_lanes_gt ¶

    simd_lanes_gt :: proc(a, b: #simd[N]T) -> #simd[N]Integer {…}
     

    Return an unsigned integer of the same size as the input type, NOT A BOOLEAN. element-wise: false => 0x00...00, true => 0xff...ff

    simd_lanes_ge ¶

    simd_lanes_ge :: proc(a, b: #simd[N]T) -> #simd[N]Integer {…}
     

    Return an unsigned integer of the same size as the input type, NOT A BOOLEAN. element-wise: false => 0x00...00, true => 0xff...ff

    simd_extract ¶

    simd_extract :: proc(a: #simd[N]T, idx: uint) -> T {…}
     

    Extracts a single scalar element from a #simd vector at a specified index.

    simd_replace ¶

    simd_replace :: proc(a: #simd[N]T, idx: uint, elem: T) -> #simd[N]T {…}
     

    Replaces a single scalar element from a #simd vector and returns a new vector.

    simd_reduce_add_ordered ¶

    simd_reduce_add_ordered :: proc(a: #simd[N]T) -> T {…}
     

    Performs a reduction of a #simd vector a, returning the result as a scalar. The return type matches the element-type T of the #simd vector input. See the following pseudocode:

    simd_reduce_add_ordered :: proc(v: #simd[N]T) -> T {
    	result := simd_extract(v, 0)
    	for i in 1..<N {
    		e := simd_extract(v, i)
    		result = result + e
    	}
    	return result
    }
    

    simd_reduce_mul_ordered ¶

    simd_reduce_mul_ordered :: proc(a: #simd[N]T) -> T {…}
     

    Performs a reduction of a #simd vector a, returning the result as a scalar. The return type matches the element-type T of the #simd vector input. See the following pseudocode:

    simd_reduce_mul_ordered :: proc(v: #simd[N]T) -> T {
    	result := simd_extract(v, 0)
    	for i in 1..<N {
    		e := simd_extract(v, i)
    		result = result * e
    	}
    	return result
    }
    

    simd_reduce_min ¶

    simd_reduce_min :: proc(a: #simd[N]T) -> T {…}
     

    Performs a reduction of a #simd vector a, returning the result as a scalar. The return type matches the element-type T of the #simd vector input. See the following pseudocode:

    simd_reduce_min :: proc(v: #simd[N]T) -> T {
    	result := simd_extract(v, 0)
    	for i in 1..<N {
    		e := simd_extract(v, i)
    		result = min(result, e)
    	}
    	return result
    }
    

    simd_reduce_max ¶

    simd_reduce_max :: proc(a: #simd[N]T) -> T {…}
     

    Performs a reduction of a #simd vector a, returning the result as a scalar. The return type matches the element-type T of the #simd vector input. See the following pseudocode:

    simd_reduce_max :: proc(v: #simd[N]T) -> T {
    	result := simd_extract(v, 0)
    	for i in 1..<N {
    		e := simd_extract(v, i)
    		result = max(result, e)
    	}
    	return result
    }
    

    simd_reduce_and ¶

    simd_reduce_and :: proc(a: #simd[N]T) -> T {…}
     

    Performs a reduction of a #simd vector a, returning the result as a scalar. The return type matches the element-type T of the #simd vector input. See the following pseudocode:

    simd_reduce_and :: proc(v: #simd[N]T) -> T {
    	result := simd_extract(v, 0)
    	for i in 1..<N {
    		e := simd_extract(v, i)
    		result = result & e
    	}
    	return result
    }
    

    simd_reduce_or ¶

    simd_reduce_or :: proc(a: #simd[N]T) -> T {…}
     

    Performs a reduction of a #simd vector a, returning the result as a scalar. The return type matches the element-type T of the #simd vector input. See the following pseudocode:

    simd_reduce_or :: proc(v: #simd[N]T) -> T {
    	result := simd_extract(v, 0)
    	for i in 1..<N {
    		e := simd_extract(v, i)
    		result = result | e
    	}
    	return result
    }
    

    simd_reduce_xor ¶

    simd_reduce_xor :: proc(a: #simd[N]T) -> T {…}
     

    Performs a reduction of a #simd vector a, returning the result as a scalar. The return type matches the element-type T of the #simd vector input. See the following pseudocode:

    simd_reduce_xor :: proc(v: #simd[N]T) -> T {
    	result := simd_extract(v, 0)
    	for i in 1..<N {
    		e := simd_extract(v, i)
    		result = result ~ e
    	}
    	return result
    }
    

    simd_shuffle ¶

    simd_shuffle :: proc(a, b: #simd[N]T, $indices: ..int) -> #simd[len(indices)]T {…}
     

    The first two operators of simd_shuffle are #simd vectors of the same type. The indices following these represent the shuffle mask values. The mask elements must be constant integers. The result of the procedure is a vector whose length is the same as the number of indices passed to the procedure type.

    The elements of the two input #simd vectors are numbers from left to right across both of the vectors. For each element of the result #simd vector, the shuffle indices selement an element from one of the two input vectors to copy to the result.

    Example:
    a, b: #simd[4]T = ...
    x: #simd[4]T = intrinsics.simd_shuffle(a, b, 0, 1, 2, 3) // identity shuffle of `a`
    y: #simd[4]T = intrinsics.simd_shuffle(a, b, 4, 5, 6, 7) // identity shuffle of `b`
    z: #simd[4]T = intrinsics.simd_shuffle(a, b, 0, 4, 1, 5)
    w: #simd[8]T = intrinsics.simd_shuffle(a, b, 0, 1, 2, 3, 4, 5, 6, 7)
    v: #simd[6]T = intrinsics.simd_shuffle(a, b, 0, 1, 0, 3, 0, 4) // repeated indices and different sized vector
    

    simd_select ¶

    simd_select :: proc(cond: #simd[N]boolean_or_integer, true, false: #simd[N]T) -> #simd[N]T {…}

    simd_ceil ¶

    simd_ceil :: proc(a: #simd[N]any_float) -> #simd[N]any_float {…}
     

    lane-wise ceil

    simd_floor ¶

    simd_floor :: proc(a: #simd[N]any_float) -> #simd[N]any_float {…}
     

    lane-wise floor

    simd_trunc ¶

    simd_trunc :: proc(a: #simd[N]any_float) -> #simd[N]any_float {…}
     

    lane-wise trunc

    simd_nearest ¶

    simd_nearest :: proc(a: #simd[N]any_float) -> #simd[N]any_float {…}
     

    rounding to the nearest integral value; if two values are equally near, rounds to the even one

    simd_to_bits ¶

    simd_to_bits :: proc(v: #simd[N]T) -> #simd[N]Integer where size_of(T) == size_of(Integer), type_is_unsigned(Integer) {…}

    simd_reverse ¶

    simd_reverse :: proc(a: #simd[N]T) -> #simd[N]T {…}
     

    equivalent a swizzle with descending indices, e.g. reserve(a, 3, 2, 1, 0)

    simd_rotate_left ¶

    simd_rotate_left :: proc(a: #simd[N]T, $offset: int) -> #simd[N]T {…}

    simd_rotate_right ¶

    simd_rotate_right :: proc(a: #simd[N]T, $offset: int) -> #simd[N]T {…}

    wasm_memory_grow ¶

    wasm_memory_grow :: proc(index, delta: uintptr) -> int {…}
     

    WASM targets only

    wasm_memory_size ¶

    wasm_memory_size :: proc(index: uintptr) -> int {…}
     

    WASM targets only

    wasm_memory_atomic_wait32 ¶

    wasm_memory_atomic_wait32 :: proc(ptr: ^u32, expected: u32, timeout_ns: i64) -> u32 {…}
     

    timeout_ns is maximum number of nanoseconds the calling thread will be blocked for A negative value will be blocked forever Return value: 0 - indicates that the thread blocked and then was woken up 1 - the loaded value from ptr did not match expected, the thread did not block 2 - the thread blocked, but the timeout

    wasm_memory_atomic_notify32 ¶

    wasm_memory_atomic_notify32 :: proc(ptr: ^u32, waiters: u32) -> (waiters_woken_up: u32) {…}
     

    timeout_ns is maximum number of nanoseconds the calling thread will be blocked for A negative value will be blocked forever Return value: 0 - indicates that the thread blocked and then was woken up 1 - the loaded value from ptr did not match expected, the thread did not block 2 - the thread blocked, but the timeout

    x86_cpuid ¶

    x86_cpuid :: proc(ax, cx: u32) -> (eax, ebx, ecx, edx: u32) {…}
     

    x86 Targets Only (i386, amd64) Implements the cpuid instruction.

    x86_xgetbv ¶

    x86_xgetbv :: proc(cx: u32) -> (eax, edx: u32) {…}
     

    x86 Targets Only (i386, amd64) Implements in xgetbv instruction.

    objc_find_selector ¶

    objc_find_selector :: proc($name: string) -> objc_SEL {…}
     

    Darwin targets only Will return a run-time cached selector value for the given constant string value.

    objc_register_selector ¶

    objc_register_selector :: proc($name: string) -> objc_SEL {…}
     

    Darwin targets only Will register a selector value at run-time for the given constant string value.

    objc_find_class ¶

    objc_find_class :: proc($name: string) -> objc_Class {…}
     

    Darwin targets only Will return a run-time cached class value for the given constant string value.

    objc_register_class ¶

    objc_register_class :: proc($name: string) -> objc_Class {…}
     

    Darwin targets only Will register a class value at run-time for the given constant string value.

    Procedure Groups