github.com/JimmyHuang454/JLS-go@v0.0.0-20230831150107-90d536585ba0/internal/bytealg/index_ppc64x.go (about)

     1  // Copyright 2021 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 (aix || linux) && (ppc64 || ppc64le)
     6  
     7  package bytealg
     8  
     9  import "internal/cpu"
    10  
    11  const MaxBruteForce = 16
    12  
    13  var SupportsPower9 = cpu.PPC64.IsPOWER9
    14  
    15  func init() {
    16  	MaxLen = 32
    17  }
    18  
    19  // Cutover reports the number of failures of IndexByte we should tolerate
    20  // before switching over to Index.
    21  // n is the number of bytes processed so far.
    22  // See the bytes.Index implementation for details.
    23  func Cutover(n int) int {
    24  	// 1 error per 8 characters, plus a few slop to start.
    25  	return (n + 16) / 8
    26  }