Skip to content

Commit 95309c2

Browse files
committed
Fix values unintentionally wrapping while in range
1 parent 96c563d commit 95309c2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Runtime/Processors.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,8 +1076,10 @@ public static int Wrap(int input, int min, int max)
10761076
{
10771077
if (input < min) {
10781078
return max - (min - input) % (max - min);
1079-
} else {
1079+
} else if (input > max) {
10801080
return min + (input - min) % (max - min);
1081+
} else {
1082+
return input;
10811083
}
10821084
}
10831085

@@ -1201,8 +1203,10 @@ public static int Wrap01(int input)
12011203
{
12021204
if (input < 0) {
12031205
return 1 - (-input % 1);
1204-
} else {
1206+
} else if (input > 1) {
12051207
return input % 1;
1208+
} else {
1209+
return input;
12061210
}
12071211
}
12081212

0 commit comments

Comments
 (0)