make SafeUint64 generic

This commit is contained in:
2026-06-26 20:38:01 +00:00
parent 41a06f6b45
commit d6173c8675
+2 -1
View File
@@ -50,7 +50,8 @@ func FormatNumber(val uint64, base uint64) (string, string) {
} }
} }
func SafeUint64(i int) uint64 { // Converts int, int32, and int64 to uint64. Less than 0 check.
func SafeUint64[I int | int32 | int64](i I) uint64 {
if i < 0 { if i < 0 {
log.Printf("Tried to cast %d to uint64", i) log.Printf("Tried to cast %d to uint64", i)
return 0 return 0