Skip to content

Commit

Permalink
Add clamp function
Browse files Browse the repository at this point in the history
  • Loading branch information
unitoftime committed Oct 21, 2024
1 parent 45b8414 commit 84ac267
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions glm/helper.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package glm

import "cmp"

func Clamp[T cmp.Ordered] (low, high, val T) T {
return min(high, max(low, val))
}

0 comments on commit 84ac267

Please sign in to comment.