github.com/nvi-inc/fsgo@v0.2.1/versions/fs9.11.8/utils.go (about) 1 // Copyright 2019 NVI Inc. All rights reserved. 2 // Use of this source code is governed by a MIT 3 // license that can be found in the LICENSE file. 4 5 package fs 6 7 import "math" 8 import "strings" 9 10 func IsNan32(f float32) bool { 11 return f != f 12 } 13 14 func IsInf32(f float32) bool { 15 return f < -math.MaxFloat32 || f > math.MaxFloat32 16 } 17 18 // Convert a null-terminated byte array to a native Go string 19 func cstr(str []byte) string { 20 n := 0 21 for ; str[n] != 0; n++ { 22 } 23 if n == 0 { 24 return "" 25 } 26 return string(str[:n-1]) 27 } 28 29 // Convert a space padded byte array to a native Go string 30 func fsstr(s []byte) string { 31 return strings.TrimSpace(string(s)) 32 }