github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/compiler/testdata/zeromap.go (about)

     1  package main
     2  
     3  type hasPadding struct {
     4  	b1 bool
     5  	i  int
     6  	b2 bool
     7  }
     8  
     9  type nestedPadding struct {
    10  	b bool
    11  	hasPadding
    12  	i int
    13  }
    14  
    15  //go:noinline
    16  func testZeroGet(m map[hasPadding]int, s hasPadding) int {
    17  	return m[s]
    18  }
    19  
    20  //go:noinline
    21  func testZeroSet(m map[hasPadding]int, s hasPadding) {
    22  	m[s] = 5
    23  }
    24  
    25  //go:noinline
    26  func testZeroArrayGet(m map[[2]hasPadding]int, s [2]hasPadding) int {
    27  	return m[s]
    28  }
    29  
    30  //go:noinline
    31  func testZeroArraySet(m map[[2]hasPadding]int, s [2]hasPadding) {
    32  	m[s] = 5
    33  }
    34  
    35  func main() {
    36  
    37  }