Skip to content

Commit

Permalink
Doing some roundabout things to avoid preprocessor madness.
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahelsaig committed Oct 18, 2023
1 parent 221050f commit 1a9cff3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void Disposer(ReservedDevice thisReservedDevice)

var reservationCompletionSource = new TaskCompletionSource<IReservedDevice>();

_waitQueue.Enqueue(freedUpDevice => reservationCompletionSource.SetResult(freedUpDevice));
_waitQueue.Enqueue(reservationCompletionSource.SetResult);

return reservationCompletionSource.Task;
}
Expand Down
10 changes: 5 additions & 5 deletions src/Hastlayer/Hast.Transformer/SimpleMemory/SimpleMemory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class SimpleMemory
/// The alignment value. If set to greater than 0, the starting address of the content is aligned to be a multiple
/// of that number. It must be an integer and power of 2.
/// </param>
internal SimpleMemory(Memory<byte> memory, int prefixCellCount, int alignment)
internal SimpleMemory(Memory<byte> memory, int prefixCellCount, int alignment, bool isDebug)
{
if (alignment > 0)
{
Expand All @@ -102,7 +102,7 @@ internal SimpleMemory(Memory<byte> memory, int prefixCellCount, int alignment)
{
memory = memory.Slice(alignmentOffset, memory.Length - alignment);
}
else if (IsDebug)
else if (isDebug)
{
// This should never happen in production.
Console.Error.WriteLine("Alignment failed!");
Expand Down Expand Up @@ -174,7 +174,7 @@ public static SimpleMemory Create(IMemoryConfiguration memoryConfiguration, int
{
var memory = new byte[((cellCount + memoryConfiguration.MinimumPrefix) * MemoryCellSizeBytes) +
memoryConfiguration.Alignment];
return new SimpleMemory(memory, memoryConfiguration.MinimumPrefix, memoryConfiguration.Alignment);
return new SimpleMemory(memory, memoryConfiguration.MinimumPrefix, memoryConfiguration.Alignment, IsDebug);
}

/// <summary>
Expand Down Expand Up @@ -209,7 +209,7 @@ public static SimpleMemory Create(IMemoryConfiguration memoryConfiguration, int
withPrefixCells = memoryConfiguration.MinimumPrefix;
}

return new SimpleMemory(memory, withPrefixCells, 0);
return new SimpleMemory(memory, withPrefixCells, 0, IsDebug);
}

/// <summary>
Expand All @@ -219,7 +219,7 @@ public static SimpleMemory Create(IMemoryConfiguration memoryConfiguration, int
/// <param name="cellCount">The size of the usable memory.</param>
/// <returns>The instance with a <c>byte[]</c> of capacity for the require payload size.</returns>
public static SimpleMemory CreateSoftwareMemory(int cellCount) =>
new(new byte[cellCount * MemoryCellSizeBytes], 0, 0);
new(new byte[cellCount * MemoryCellSizeBytes], 0, 0, IsDebug);
}

/// <summary>
Expand Down

0 comments on commit 1a9cff3

Please sign in to comment.