!41 编写UtilsToU64, UtilsToU32函数

Merge pull request !41 from a-alpha/alpha-dev
This commit is contained in:
a-alpha 2022-11-07 03:19:27 +00:00 committed by Gitee
commit 79460feb7a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 15 additions and 0 deletions

View File

@ -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))
}