bytealg_bootstrap.mx raw

   1  // Copyright 2020 The Go Authors. All rights reserved.
   2  // Use of this source code is governed by a BSD-style
   3  // license that can be found in the LICENSE file.
   4  
   5  //go:build compiler_bootstrap
   6  
   7  package strconv
   8  
   9  // index returns the index of the first instance of c in s, or -1 if missing.
  10  func index(s []byte, c byte) int {
  11  	for i := 0; i < len(s); i++ {
  12  		if s[i] == c {
  13  			return i
  14  		}
  15  	}
  16  	return -1
  17  }
  18