Skip to content

Commit 928c0d7

Browse files
committed
Wrote Min Max and Clamp helpers.
1 parent f52e25f commit 928c0d7

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

LibIPS.NET/LibIpsNet.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,19 @@ private bool Compare(BinaryReader source, int sourceStart, BinaryReader target,
408408
return true;
409409
}
410410

411+
private long Min(long a, long b)
412+
{
413+
return (a) < (b) ? (a) : (b);
414+
}
411415

416+
private long Max(long a, long b)
417+
{
418+
return (a) > (b) ? (a) : (b);
419+
}
420+
421+
private long Clamp(long a, long b, long c)
422+
{
423+
return Max(a, Min(b, c));
424+
}
412425
}
413426
}

0 commit comments

Comments
 (0)