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