You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
539 B
Go

package utils
import "unsafe"
func StringToByteSlice(s string) []byte {
return *(*[]byte)(unsafe.Pointer(&s))
}
func ByteSliceToString(b []byte) string {
return *(*string)(unsafe.Pointer(&b))
}
func Uint64ToInt64(val uint64) int64 {
return *(*int64)(unsafe.Pointer(&val))
}
func Uint64ToFloat64(val uint64) float64 {
return *(*float64)(unsafe.Pointer(&val))
}
func Int64ToUint64(val int64) uint64 {
return *(*uint64)(unsafe.Pointer(&val))
}
func Float64ToUint64(val float64) uint64 {
return *(*uint64)(unsafe.Pointer(&val))
}