Table of Contents

Class UnsafeUtil

Namespace
Zyl.VectorTraits.Impl.Util
Assembly
VectorTraits.dll

Unsafe's utility functions (Unsafe 的工具函数) .

public static class UnsafeUtil
Inheritance
UnsafeUtil
Inherited Members

Methods

BitCast<TFrom, TTo>(TFrom)

Reinterprets the given value of type TFrom as a value of type TTo.

Dec<T>(ref T)

Decrement to the given managed pointer (向给定的托管指针递减). Mnemonic: --p.

GetArrayDataReference<T>(T[])

Returns a reference to the 0th element of array. If the array is empty, returns a reference to where the 0th element would have been stored. Such a reference may be used for pinning but must never be dereferenced.

GetOffset<T>(ref T, ref T)

Determines byte offset from origin to target from the given references (确定给定托管指针从源到目标的字节偏移量).

GetReference<T>(ReadOnlySpan<T>)

Returns a reference to the element of the read-only span at index 0 (返回只读跨度在索引0处的引用).

GetReference<T>(Span<T>)

Returns a reference to the element of the span at index 0 (返回跨度在索引0处的引用).

Inc<T>(ref T)

Increment to the given managed pointer (向给定的托管指针递增). Mnemonic: ++p.

IsAddressGreaterThanOrEqual<T>(ref T, ref T)

Determines whether the memory address referenced by left is greater or equal than the memory address referenced by right (返回一个值,该值指示指定的托管指针是否大于另一个指定的托管指针).

IsAddressGreaterThanOrEqual<T>(ref T, ref T, int)
IsAddressLessThaOrEqual<T>(ref T, ref T)

Determines whether the memory address referenced by left is less or equal than the memory address referenced by right (返回一个值,该值指示指定的托管指针是否小于另一个指定的托管指针).

IsNullRef<T>(ref T)

Determines if a given managed pointer to a value of type T is a null reference (确定指向类型的 T 值的给定托管指针是否为 null 引用).

NullRef<T>()

Returns a reference to a value of type T that is a null reference (返回指向 T 类型的值的 null 托管指针).

PostDecExceptZero<T>(ref T, out T, T)

When not equal to the zero, post-decrement of the given managed pointer (当不与0相等时, 向给定的托管指针后置递减). Mnemonic: beforeValue = (*p != 0) ? *p-- : newValue).

PostDecExcept<T>(ref T, out T, T)

When not equal to the specified value, post-decrement of the given managed pointer (当不与指定值相等时, 向给定的托管指针后置递减). Mnemonic: beforeValue = (*p != checkValue) ? *p-- : newValue).

PostDecExcept<T>(ref T, out T, T, T)

When not equal to the specified value, post-decrement of the given managed pointer. It contains the checkValue parameter (当不与指定值相等时, 向给定的托管指针后置递减. 它含有 checkValue 参数). Mnemonic: beforeValue = (*p != checkValue) ? *p-- : newValue).

PostDec<T>(ref T, out T)

Post-decrement to the given managed pointer. It also returns the value pointed to before the decrement (向给定的托管指针后置递减. 还会返回递减之前所指向的值). Mnemonic: beforeValue = p--.

PostIncExceptZero<T>(ref T, out T, T)

When not equal to the zero, post-increment of the given managed pointer (当不与0相等时, 向给定的托管指针后置递增). Mnemonic: beforeValue = (*p != 0) ? *p++ : newValue).

PostIncExcept<T>(ref T, out T, T)

When not equal to the specified value, post-increment of the given managed pointer (当不与指定值相等时, 向给定的托管指针后置递增). Mnemonic: beforeValue = (*p != checkValue) ? *p++ : newValue).

PostIncExcept<T>(ref T, out T, T, T)

When not equal to the specified value, post-increment of the given managed pointer. It contains the checkValue parameter (当不与指定值相等时, 向给定的托管指针后置递增. 它含有 checkValue 参数). Mnemonic: beforeValue = (*p != checkValue) ? *p++ : newValue).

PostInc<T>(ref T, out T)

Post-increment to the given managed pointer. It also returns the value pointed to before the increment (向给定的托管指针后置递增. 还会返回递增之前所指向的值). Mnemonic: beforeValue = p++.

PreDec<T>(ref T, out T)

Pre-decrement to the given managed pointer. It also returns the value pointed to after the decrement (向给定的托管指针前置递减. 还会返回递减之后所指向的值). Mnemonic: afterValue = --p.

PreInc<T>(ref T, out T)

Pre-increment to the given managed pointer. It also returns the value pointed to after the increment (向给定的托管指针前置递增. 还会返回递增之后所指向的值). Mnemonic: afterValue = ++p.

SkipInit<T>(out T)

Bypasses definite assignment rules for a given reference (使给定引用, 绕过明确赋值规则).

UncheckGetItemReference<T>(T[], int)

Get a reference to an array item, and bypass the array bounds check if possible (获取数组项目的引用, 并尽可能绕过数组边界检查).

UncheckGetItemReference<T>(T[], int, int)

Get a reference to an array item, and bypass the array bounds check if possible (获取数组项目的引用, 并尽可能绕过数组边界检查).

UncheckGetItemReference<T>(T[], nint)

Get a reference to an array item, and bypass the array bounds check if possible (获取数组项目的引用, 并尽可能绕过数组边界检查).

UncheckGetItemReference<T>(T[], nint, nint)

Get a reference to an array item, and bypass the array bounds check if possible (获取数组项目的引用, 并尽可能绕过数组边界检查).

See Also