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
sourceReadOnlySpan<byte>The span from which the two's complement number should be read.
isUnsignedbooltrue if
sourcerepresents an unsigned two's complement number; otherwise, false to indicate it represents a signed two's complement number.valueTSelfOn return, contains the value read from
sourceor default if a value could not be read.
Returns
Type Parameters
TSelfTarget type (目标类型).