Is this Go code correct and portable, I need to store 2 counters (each call only one counter will be updated) in one variable to avoid locks in actual code where I am going to use single atomic.AddUint64() instead of locking whole struct.
package main
import "fmt"
var long uint64 // Actual counters storage
func main() {
left := uint32(100) // First counter
right := uint32(200) // Second counter
long = uint64(left)
long = long << 32 | uint64(right)
fmt.Println(left, right)
long += uint64(1 << 32) // Increment left
long += 1 // Increment right
xLeft := uint32(long >> 32) // Get left
xRight := uint32(long) // Get right
fmt.Println(xLeft, xRight)
}