1 Star 1 Fork 0

妙音/oils

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
byte.go 382 Bytes
Copy Edit Raw Blame History
妙音 authored 2021-04-27 15:09 . add Uint32s
package tags
const eight = uint32(8)
// Int2Byte 整数转换字节码.
func Int2Byte(i uint32) (uint32, byte) {
return i / eight, 1 << (i % eight)
}
// Byte2Ints 字节码转换整数.
func Byte2Ints(n uint32, b byte) []uint32 {
base := n * eight
ret := []uint32{}
for i := uint32(0); i < eight; i++ {
if b&(1<<i) > 0 {
ret = append(ret, base+i)
}
}
return ret
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xuender/oils.git
git@gitee.com:xuender/oils.git
xuender
oils
oils
v1.1.3

Search

23e8dbc6 1850385 7e0993f3 1850385