package brotli

import (
	
	
	
)

/* Copyright 2010 Google Inc. All Rights Reserved.

   Distributed under MIT license.
   See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
*/

/* Function to find maximal matching prefixes of strings. */
func findMatchLengthWithLimit( []byte,  []byte,  uint) uint {
	var  uint = 0
	_, _ = [-1], [-1] // bounds check
	switch runtime.GOARCH {
	case "amd64":
		// Compare 8 bytes at at time.
		for +8 <=  {
			 := binary.LittleEndian.Uint64([:])
			 := binary.LittleEndian.Uint64([:])
			if  !=  {
				return  + uint(bits.TrailingZeros64(^)>>3)
			}
			 += 8
		}
	case "386":
		// Compare 4 bytes at at time.
		for +4 <=  {
			 := binary.LittleEndian.Uint32([:])
			 := binary.LittleEndian.Uint32([:])
			if  !=  {
				return  + uint(bits.TrailingZeros32(^)>>3)
			}
			 += 4
		}
	}
	for  <  && [] == [] {
		++
	}
	return 
}