Fixed more bitness assumptions

This commit is contained in:
Yoshi Askharoun
2022-06-05 14:51:29 -05:00
parent 4953c7a0ac
commit 0c9345050b
3 changed files with 4 additions and 4 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*)((uint)pMessage + this.m_blobsOffset); byte* numPtr1 = (byte*)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*)((nint)block.data + offset); byte* start = (byte*)block.data + offset;
for (byte* current = start + size; start < current; ++start) for (byte* current = start + size; start < current; ++start)
*start = 0; *start = 0;
} }
@@ -466,11 +466,11 @@ namespace Microsoft.Iris.Render.Protocol
MessageHeap.Block block = this._currentMessageHeap.LookupBlock(pMethodMsg); MessageHeap.Block block = this._currentMessageHeap.LookupBlock(pMethodMsg);
Debug2.Throw((IntPtr)block.data != IntPtr.Zero, "message should be in current message heap"); Debug2.Throw((IntPtr)block.data != IntPtr.Zero, "message should be in current message heap");
uint num = (uint)((ulong)((sbyte*)pMethodMsg - (sbyte*)block.data) - (ulong)sizeof(MessageBatchEntry)); uint num = (uint)((ulong)((sbyte*)pMethodMsg - (sbyte*)block.data) - (ulong)sizeof(MessageBatchEntry));
if ((IntPtr)this._lastBatchEntry != IntPtr.Zero && (int)this._lastBatchBlockId == (int)block.id) if ((IntPtr)_lastBatchEntry != IntPtr.Zero && _lastBatchBlockId == block.id)
this._lastBatchEntry->uOffsetNextEntry = num; this._lastBatchEntry->uOffsetNextEntry = num;
else else
((MessageBatchHeader*)block.data)->uOffsetFirstEntry = num; ((MessageBatchHeader*)block.data)->uOffsetFirstEntry = num;
this._lastBatchEntry = (MessageBatchEntry*)((int)block.data + (int)num); this._lastBatchEntry = (MessageBatchEntry*)block.data + num;
this._lastBatchBlockId = block.id; this._lastBatchBlockId = block.id;
++this._uBatchedMessages; ++this._uBatchedMessages;
BatchCallback populateCallback = this._batchPopulateCallback; BatchCallback populateCallback = this._batchPopulateCallback;