Table of Contents

Method TryReadLittleEndian

Namespace
Zyl.VectorTraits.Numerics
Assembly
VectorTraits.dll

TryReadLittleEndian<TSelf>(ReadOnlySpan<byte>, bool, out TSelf)

Tries to read a two's complement number from a span, in little-endian format, and convert it to an instance of the current type.

public static bool TryReadLittleEndian<TSelf>(ReadOnlySpan<byte> source, bool isUnsigned, out TSelf value) where TSelf : IBinaryInteger<TSelf>

Parameters

source ReadOnlySpan<byte>

The span from which the two's complement number should be read.

isUnsigned bool

true if source represents an unsigned two's complement number; otherwise, false to indicate it represents a signed two's complement number.

value TSelf

On return, contains the value read from source or default if a value could not be read.

Returns

bool

true if the value was succesfully read from source; otherwise, false.

Type Parameters

TSelf

Target type (目标类型).