【联锁消息发送Encode处理】

This commit is contained in:
weizhihong 2023-10-25 11:09:29 +08:00
parent f8dba22a23
commit 231be3b506

View File

@ -77,10 +77,9 @@ func (m *InterlockSendMsgPkg) Encode() []byte {
// bool数组转byte // bool数组转byte
func boolsToByte(flags [8]bool) byte { func boolsToByte(flags [8]bool) byte {
var result uint8 var result uint8
for _, b := range flags { for index, b := range flags {
result <<= 1
if b { if b {
result |= 1 result = result + (1 << index)
} }
} }
return result return result