01、按照内存对齐,重新计算结构体长度
1 const ( 2 maxAlign = 8 //按照8个byte进行内存对齐 3 hchanSize = unsafe.Sizeof(hchan{}) + uintptr(-int(unsafe.Sizeof(hchan{}))&(maxAlign-1))//重新计算hchan的size,且内存对齐 4 debugChan = false 5 )
01、按照内存对齐,重新计算结构体长度
1 const ( 2 maxAlign = 8 //按照8个byte进行内存对齐 3 hchanSize = unsafe.Sizeof(hchan{}) + uintptr(-int(unsafe.Sizeof(hchan{}))&(maxAlign-1))//重新计算hchan的size,且内存对齐 4 debugChan = false 5 )