Skip to content

Instantly share code, notes, and snippets.

@AxGord
Created April 26, 2024 11:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AxGord/df2613be714912d650c52c08101243c1 to your computer and use it in GitHub Desktop.
Save AxGord/df2613be714912d650c52c08101243c1 to your computer and use it in GitHub Desktop.
subtractionWithLimit
class Test {
static function main() {
trace(subtractionWithLimit(0, 2, 1));
}
static function subtractionWithLimit(a:UInt, b:UInt, min:UInt):Int {
return Std.int(Math.max(min + b, a)) - b;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment