github.com/MetalBlockchain/subnet-evm@v0.4.9/utils/bytes.go (about)

     1  // (c) 2021-2022, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package utils
     5  
     6  // IncrOne increments bytes value by one
     7  func IncrOne(bytes []byte) {
     8  	index := len(bytes) - 1
     9  	for index >= 0 {
    10  		if bytes[index] < 255 {
    11  			bytes[index]++
    12  			break
    13  		} else {
    14  			bytes[index] = 0
    15  			index--
    16  		}
    17  	}
    18  }