Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
MdUtf8String.cs
Go to the documentation of this file.
3using System.Text;
4
5namespace System;
6
7internal readonly struct MdUtf8String
8{
9 private unsafe readonly byte* m_pStringHeap;
10
11 private readonly int m_StringHeapByteLength;
12
13 [DllImport("QCall", CharSet = CharSet.Unicode)]
14 private unsafe static extern bool EqualsCaseInsensitive(void* szLhs, void* szRhs, int cSz);
15
16 [DllImport("QCall", CharSet = CharSet.Unicode)]
17 private unsafe static extern uint HashCaseInsensitive(void* sz, int cSz);
18
19 internal unsafe MdUtf8String(void* pStringHeap)
20 {
21 if (pStringHeap != null)
22 {
23 m_StringHeapByteLength = string.strlen((byte*)pStringHeap);
24 }
25 else
26 {
28 }
29 m_pStringHeap = (byte*)pStringHeap;
30 }
31
32 internal unsafe MdUtf8String(byte* pUtf8String, int cUtf8String)
33 {
34 m_pStringHeap = pUtf8String;
35 m_StringHeapByteLength = cUtf8String;
36 }
37
38 [MethodImpl(MethodImplOptions.AggressiveInlining)]
39 internal unsafe bool Equals(MdUtf8String s)
40 {
41 if (s.m_StringHeapByteLength != m_StringHeapByteLength)
42 {
43 return false;
44 }
45 return SpanHelpers.SequenceEqual(ref *s.m_pStringHeap, ref *m_pStringHeap, (uint)m_StringHeapByteLength);
46 }
47
48 internal unsafe bool EqualsCaseInsensitive(MdUtf8String s)
49 {
50 if (s.m_StringHeapByteLength != m_StringHeapByteLength)
51 {
52 return false;
53 }
55 {
57 }
58 return true;
59 }
60
61 internal unsafe uint HashCaseInsensitive()
62 {
64 }
65
66 public unsafe override string ToString()
67 {
69 }
70}
static unsafe bool SequenceEqual(ref byte first, ref byte second, nuint length)
static Encoding UTF8
Definition Encoding.cs:526
unsafe MdUtf8String(byte *pUtf8String, int cUtf8String)
unsafe bool Equals(MdUtf8String s)
static unsafe uint HashCaseInsensitive(void *sz, int cSz)
unsafe MdUtf8String(void *pStringHeap)
readonly int m_StringHeapByteLength
unsafe bool EqualsCaseInsensitive(MdUtf8String s)
unsafe uint HashCaseInsensitive()
static unsafe bool EqualsCaseInsensitive(void *szLhs, void *szRhs, int cSz)
unsafe readonly byte * m_pStringHeap
unsafe override string ToString()