Skip to content

Commit

Permalink
Merge branch 'Albeoris:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
SamsamTS authored Sep 18, 2023
2 parents a9b8c7a + 935e207 commit 9a25be2
Show file tree
Hide file tree
Showing 32 changed files with 913 additions and 548 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ public class CalcStack
{
public Boolean push(Int32 arg0)
{
if (this.topOfStackID >= (Int32)this.stack.Length - 1)
{
if (this.topOfStackID >= this.stack.Length - 1)
return false;
}
this.stack[this.topOfStackID] = arg0;
this.topOfStackID++;
return true;
Expand All @@ -20,7 +18,7 @@ public Boolean pop(out Int32 output)
{
if (this.topOfStackID == 0)
{
Log.Error($"[{nameof(CalcStack)}.{nameof(pop)}]if (this.topOfStackID == 0)");
Log.Error($"[{nameof(CalcStack)}.{nameof(pop)}] this.topOfStackID == 0");
output = default;
return false;
}
Expand All @@ -31,30 +29,24 @@ public Boolean pop(out Int32 output)

public Boolean advanceTopOfStack()
{
if (this.topOfStackID >= (Int32)this.stack.Length - 1)
{
if (this.topOfStackID >= this.stack.Length - 1)
return false;
}
this.topOfStackID++;
return true;
}

public Boolean retreatTopOfStack()
{
if (this.topOfStackID == 0)
{
return false;
}
this.topOfStackID--;
return true;
}

public void emptyCalcStack()
{
for (Int32 i = 0; i < (Int32)this.stack.Length; i++)
{
for (Int32 i = 0; i < this.stack.Length; i++)
this.stack[i] = 0;
}
this.topOfStackID = 0;
}

Expand All @@ -68,10 +60,8 @@ public Int32 getValueAtOffset(Int32 offset)
return this.stack[this.topOfStackID + offset];
}

private const Int32 stackSize = 16;

private Int32[] stack = new Int32[16];

private const Int32 STACK_SIZE = 16;
private Int32[] stack = new Int32[STACK_SIZE];
private Int32 topOfStackID;
}
}
Loading

0 comments on commit 9a25be2

Please sign in to comment.