github.com/icodeface/tls@v0.0.0-20230910023335-34df9250cd12/internal/bytealg/indexbyte_generic.go (about) 1 // Copyright 2018 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 // +build !386,!amd64,!amd64p32,!s390x,!arm,!arm64,!ppc64,!ppc64le,!mips,!mipsle,!mips64,!mips64le,!wasm 6 7 package bytealg 8 9 func IndexByte(b []byte, c byte) int { 10 for i, x := range b { 11 if x == c { 12 return i 13 } 14 } 15 return -1 16 } 17 18 func IndexByteString(s string, c byte) int { 19 for i := 0; i < len(s); i++ { 20 if s[i] == c { 21 return i 22 } 23 } 24 return -1 25 }