请问go标准库里面有没有对一个uint32某几个bit更改或者移位的package?

karl_zhao · · 2859 次点击
import ( "log" "unsafe" ) func main() { var src uint32 = 20 var val byte = 0 for i := uintptr(0); i < unsafe.Sizeof(src); i++ { *(*byte)(unsafe.Pointer(i + uintptr(unsafe.Pointer(&src)))) = val log.Printf("Set %v at %v", val, i+uintptr(unsafe.Pointer(&src))) } log.Println(uintptr(unsafe.Pointer(&src)), src) }
#4
更多评论
我直接混进去汇编的代码
#2