github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/gnovm/tests/files/shift5.gno (about)

     1  package main
     2  
     3  func maxDepth(n int) int {
     4  	var depth int
     5  	for i := n; i > 0; i >>= 1 {
     6  		depth++
     7  	}
     8  	return depth * 2
     9  }
    10  
    11  func main() {
    12  	println(maxDepth(10))
    13  }
    14  
    15  // Output:
    16  // 8