Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ TryWriteBytes() [3/3]

static bool System.Text.Encodings.Web.SpanUtility.TryWriteBytes ( Span< byte > span,
byte a,
byte b,
byte c,
byte d,
byte e,
byte f )
inlinestatic

Definition at line 55 of file SpanUtility.cs.

56 {
57 if (span.Length >= 6)
58 {
59 uint value;
60 uint num;
61 if (BitConverter.IsLittleEndian)
62 {
63 value = (uint)((d << 24) | (c << 16) | (b << 8) | a);
64 num = (uint)((f << 8) | e);
65 }
66 else
67 {
68 value = (uint)((a << 24) | (b << 16) | (c << 8) | d);
69 num = (uint)((e << 8) | f);
70 }
71 ref byte reference = ref MemoryMarshal.GetReference(span);
72 Unsafe.WriteUnaligned(ref reference, value);
73 Unsafe.WriteUnaligned(ref Unsafe.Add(ref reference, 4), (ushort)num);
74 return true;
75 }
76 return false;
77 }
int Length
Definition Span.cs:70

References System.BitConverter.IsLittleEndian, System.Span< T >.Length, and System.Text.Encodings.Web.value.