Method TryReadBigEndian
- Namespace
- Zyl.VectorTraits.Numerics
- Assembly
- VectorTraits.dll
TryReadBigEndian<TSelf>(ReadOnlySpan<byte>, bool, out TSelf)
Tries to read a two's complement number from a span, in big-endian format, and convert it to an instance of the current type.
public static bool TryReadBigEndian<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
booltrue if
source
represents an unsigned two's complement number; otherwise, false to indicate it represents a signed two's complement number.value
TSelfOn return, contains the value read from
source
or default if a value could not be read.
Returns
Type Parameters
TSelf
Target type (目标类型).