Source file test/fixedbugs/issue15585.go

     1  // compile
     2  
     3  // Copyright 2016 The Go Authors. All rights reserved.
     4  // Use of this source code is governed by a BSD-style
     5  // license that can be found in the LICENSE file.
     6  
     7  package bug
     8  
     9  func example(n int) (rc int) {
    10  	var cc, ll, pp, rr [27]int
    11  	for q0 := 0; q0 < n-2; q0++ {
    12  		for q1 := q0 + 2; q1 < n; q1++ {
    13  			var c, d, l, p, r int
    14  			b0 := 1 << uint(q0)
    15  			b1 := 1 << uint(q1)
    16  			l = ((b0 << 1) | b1) << 1
    17  			c = b0 | b1 | (-1 << uint(n))
    18  			r = ((b0 >> 1) | b1) >> 1
    19  		E:
    20  			if c != -1 {
    21  				p = ^(l | c | r)
    22  			} else {
    23  				rc++
    24  				goto R
    25  			}
    26  		L:
    27  			if p != 0 {
    28  				lsb := p & -p
    29  				p &^= lsb
    30  				ll[d], cc[d], rr[d], pp[d] = l, c, r, p
    31  				l, c, r = (l|lsb)<<1, c|lsb, (r|lsb)>>1
    32  				d++
    33  				goto E
    34  			}
    35  		R:
    36  			d--
    37  			if d >= 0 {
    38  				l, c, r, p = ll[d], cc[d], rr[d], pp[d]
    39  				goto L
    40  			}
    41  		}
    42  	}
    43  	rc <<= 1
    44  	return
    45  }
    46  

View as plain text