mirror of https://gitee.com/openkylin/genmai.git
编写UtilsToU64, UtilsToU32函数
This commit is contained in:
parent
d8b6e2cc47
commit
1700692398
|
@ -47,3 +47,18 @@ func UtilsToS32(i int) string {
|
|||
/* */
|
||||
return string(bytes)
|
||||
}
|
||||
|
||||
|
||||
func UtilsToU64(s sting) int {
|
||||
bytes := make([]byte, 8)
|
||||
copy(bytes, []byte(s))
|
||||
/* */
|
||||
return int(binary.LittleEndian.Uint64(bytes))
|
||||
}
|
||||
|
||||
func UtilsToU32(s string) int {
|
||||
bytes := make([]byte, 4)
|
||||
copy(bytes, []byte(s))
|
||||
/* */
|
||||
return int(binary.LittleEndian.Uint32(bytes))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue