Reverted incorrect assumption about pointer casts/arithmetic

This commit is contained in:
Yoshi Askharoun
2022-06-05 16:38:46 -05:00
parent 0c9345050b
commit c1fe12288c
3 changed files with 3 additions and 3 deletions
@@ -78,7 +78,7 @@ namespace Microsoft.Iris.Render.Protocol
public unsafe void Attach(Message* pMessage) public unsafe void Attach(Message* pMessage)
{ {
byte* numPtr1 = (byte*)pMessage + this.m_blobsOffset; byte* numPtr1 = (byte*)((nint)pMessage + this.m_blobsOffset);
foreach (object obj in this.m_data) foreach (object obj in this.m_data)
{ {
if (obj is string) if (obj is string)
@@ -181,7 +181,7 @@ namespace Microsoft.Iris.Render.Protocol
private unsafe void ZeroMemoryBlock(MessageHeap.BlockInfo block, uint offset, uint size) private unsafe void ZeroMemoryBlock(MessageHeap.BlockInfo block, uint offset, uint size)
{ {
Debug2.Validate(offset + size <= block.size, typeof(ArgumentOutOfRangeException), "Invalid memory range for block"); Debug2.Validate(offset + size <= block.size, typeof(ArgumentOutOfRangeException), "Invalid memory range for block");
byte* start = (byte*)block.data + offset; byte* start = (byte*)((nint)block.data + offset);
for (byte* current = start + size; start < current; ++start) for (byte* current = start + size; start < current; ++start)
*start = 0; *start = 0;
} }
@@ -470,7 +470,7 @@ namespace Microsoft.Iris.Render.Protocol
this._lastBatchEntry->uOffsetNextEntry = num; this._lastBatchEntry->uOffsetNextEntry = num;
else else
((MessageBatchHeader*)block.data)->uOffsetFirstEntry = num; ((MessageBatchHeader*)block.data)->uOffsetFirstEntry = num;
this._lastBatchEntry = (MessageBatchEntry*)block.data + num; this._lastBatchEntry = (MessageBatchEntry*)((nint)block.data + num);
this._lastBatchBlockId = block.id; this._lastBatchBlockId = block.id;
++this._uBatchedMessages; ++this._uBatchedMessages;
BatchCallback populateCallback = this._batchPopulateCallback; BatchCallback populateCallback = this._batchPopulateCallback;