- private fixed uint _blocks[MaxBlockCount];
-
- public ref uint this[int index]
- {
- get
- {
- Debug.Assert(unchecked((uint)(index)) <= MaxBlockCount);
- return ref Unsafe.Add(ref GetPinnableReference(), index);
- }
- }
-
- public ref uint GetPinnableReference()
- {
- var pThis = Unsafe.AsPointer(ref this);
- return ref Unsafe.AsRef<uint>(pThis);
- }
-
- public uint* GetPointer()
- {
- return (uint*)(Unsafe.AsPointer(ref this));
- }
+ // This is safe to do since we are a ref struct
+ return (uint*)(Unsafe.AsPointer(ref _blocks[0]));