// fillWithRepeats returns v*ceiling(len(pattern) / v) bytes consisting of
// repeats of pattern.
977995
func fillWithRepeats(pattern []byte, v int) []byte {
	if len(pattern) == 0 {
		return nil
	}
	outputLen := v * ((len(pattern) + v - 1) / v)
	return bytes.Repeat(pattern, (outputLen+len(pattern)-1)/len(pattern))[:outputLen]
}
1106551
func (_m Map) Fill(m Map) {
	for key, value := range _m {
		m[key] = value
	}
}
580642
func (a *SynthesizeScrollGestureArgs) SetRepeatCount(repeatCount int) *SynthesizeScrollGestureArgs {
	a.RepeatCount = &repeatCount
	return a
}
783854
func fillStructRecursive(objValue reflect.Value, defaultPointerValMap map[string]reflect.Value, valMap map[string]parse.Parser, key string) error {
	name := key
	switch objValue.Kind() {
	case reflect.Struct:

		for i := 0; i < objValue.Type().NumField(); i++ {
			if objValue.Type().Field(i).Anonymous {
				if err := fillStructRecursive(objValue.Field(i), defaultPointerValMap, valMap, name); err != nil {
					return err
				}
			} else if len(objValue.Type().Field(i).Tag.Get("description")) > 0 {
				fieldName := objValue.Type().Field(i).Name
				if tag := objValue.Type().Field(i).Tag.Get("long"); len(tag) > 0 {
					fieldName = tag
				}

				if len(key) == 0 {
					name = strings.ToLower(fieldName)
				} else {
					name = key + "." + strings.ToLower(fieldName)
				}

				if objValue.Field(i).Kind() != reflect.Ptr {
					if val, ok := valMap[name]; ok {
						if err := setFields(objValue.Field(i), val); err != nil {
							return err
						}
					}
				}

				if err := fillStructRecursive(objValue.Field(i), defaultPointerValMap, valMap, name); err != nil {
					return err
				}
			}
		}

	case reflect.Ptr:
		if len(key) == 0 && !objValue.IsNil() {
			return fillStructRecursive(objValue.Elem(), defaultPointerValMap, valMap, name)
		}

		contains := false
		for flg := range valMap {
			// TODO replace by regexp
			if strings.HasPrefix(flg, name+".") {
				contains = true
				break
			}
		}

		needDefault := false
		if _, ok := valMap[name]; ok {
			needDefault = valMap[name].Get().(bool)
		}
		if contains && objValue.IsNil() {
			needDefault = true
		}

		if needDefault {
			if defVal, ok := defaultPointerValMap[name]; ok {
				// set default pointer value
				objValue.Set(defVal)
			} else {
				return fmt.Errorf("flag %s default value not provided", name)
			}
		}

		if !objValue.IsNil() && contains {
			if objValue.Type().Elem().Kind() == reflect.Struct {
				if err := fillStructRecursive(objValue.Elem(), defaultPointerValMap, valMap, name); err != nil {
					return err
				}
			}
		}
	default:
		return nil
	}
	return nil
}
999537
func (a *SynthesizeScrollGestureArgs) SetRepeatDelayMs(repeatDelayMs int) *SynthesizeScrollGestureArgs {
	a.RepeatDelayMs = &repeatDelayMs
	return a
}
350654
func Fill(n int, input Input) []Input {
	a := make([]Input, n)
	for i := range a {
		a[i] = input
	}
	return a
}
522410
func (c *Cluster) FillDefaults() error {
	// Topology support
	if c.Spec.Topology == nil {
		c.Spec.Topology = &TopologySpec{Masters: TopologyPublic, Nodes: TopologyPublic}
		c.Spec.Topology.DNS = &DNSSpec{Type: DNSTypePublic}
	}

	if c.Spec.Networking == nil {
		c.Spec.Networking = &NetworkingSpec{}
	}

	// TODO move this into networking.go :(
	if c.Spec.Networking.Classic != nil {
		// OK
	} else if c.Spec.Networking.Kubenet != nil {
		// OK
	} else if c.Spec.Networking.CNI != nil {
		// OK
	} else if c.Spec.Networking.External != nil {
		// OK
	} else if c.Spec.Networking.Kopeio != nil {
		// OK
	} else if c.Spec.Networking.Weave != nil {
		// OK
	} else if c.Spec.Networking.Flannel != nil {
		// OK
	} else if c.Spec.Networking.Calico != nil {
		// OK
	} else if c.Spec.Networking.Canal != nil {
		// OK
	} else if c.Spec.Networking.Kuberouter != nil {
		// OK
	} else if c.Spec.Networking.Romana != nil {
		// OK
	} else if c.Spec.Networking.AmazonVPC != nil {
		// OK
	} else if c.Spec.Networking.Cilium != nil {
		if c.Spec.Networking.Cilium.Version == "" {
			c.Spec.Networking.Cilium.Version = CiliumDefaultVersion
		}
		// OK
	} else if c.Spec.Networking.LyftVPC != nil {
		// OK
	} else {
		// No networking model selected; choose Kubenet
		c.Spec.Networking.Kubenet = &KubenetNetworkingSpec{}
	}

	if c.Spec.Channel == "" {
		c.Spec.Channel = DefaultChannel
	}

	if c.ObjectMeta.Name == "" {
		return fmt.Errorf("cluster Name not set in FillDefaults")
	}

	if c.Spec.MasterInternalName == "" {
		c.Spec.MasterInternalName = "api.internal." + c.ObjectMeta.Name
	}

	if c.Spec.MasterPublicName == "" {
		c.Spec.MasterPublicName = "api." + c.ObjectMeta.Name
	}

	return nil
}
645351
func builtinRepeat(args []types.Datum, _ context.Context) (d types.Datum, err error) {
	str, err := args[0].ToString()
	if err != nil {
		return d, err
	}
	ch := fmt.Sprintf("%v", str)
	num := 0
	x := args[1]
	switch x.Kind() {
	case types.KindInt64:
		num = int(x.GetInt64())
	case types.KindUint64:
		num = int(x.GetUint64())
	}
	if num < 1 {
		d.SetString("")
		return d, nil
	}
	d.SetString(strings.Repeat(ch, num))
	return d, nil
}
612155
func BuildPattern(operand Operand, children ...*Pattern) *Pattern {
	p := &Pattern{Operand: operand}
	p.Children = children
	return p
}
376924
func (vr *vectorRenderer) SetFillColor(c drawing.Color) {
	vr.s.FillColor = c
}
75013
func fillIndex(json string, c *parseContext) {
	if len(c.value.Raw) > 0 && !c.calcd {
		jhdr := *(*reflect.StringHeader)(unsafe.Pointer(&json))
		rhdr := *(*reflect.StringHeader)(unsafe.Pointer(&(c.value.Raw)))
		c.value.Index = int(rhdr.Data - jhdr.Data)
		if c.value.Index < 0 || c.value.Index >= len(json) {
			c.value.Index = 0
		}
	}
}
734622
func WithRetryOpts(value retry.Opts) copts.Opt {
	return func(p copts.Params) {
		if setter, ok := p.(retryOptsSetter); ok {
			setter.SetRetryOpts(value)
		}
	}
}
418013
func fillBase(dst []baseOffset, base uint32, bits ...uint8) {
	if len(bits) != len(dst) {
		panic(fmt.Sprintf("len(dst) (%d) != len(bits) (%d)", len(dst), len(bits)))
	}
	for i, bit := range bits {
		if base > math.MaxInt32 {
			panic(fmt.Sprintf("invalid decoding table, base overflows int32"))
		}

		dst[i] = baseOffset{
			baseLine: base,
			addBits:  bit,
		}
		base += 1 << bit
	}
}
132238
func (o *ObjectConstraint) PatternProperties(key *regexp.Regexp, c Constraint) *ObjectConstraint {
	o.proplock.Lock()
	defer o.proplock.Unlock()

	o.patternProperties[key] = c
	return o
}
1000730
func (s *H264Settings) SetRepeatPps(v string) *H264Settings {
	s.RepeatPps = &v
	return s
}
866996
func (p Pattern) Expand() []string {
	var labels []string
	for i := range p.Seq {
		switch {
		case p.Prefix != "" && p.Suffix == "":
			labels = append(labels, fmt.Sprintf("%s%s", p.Prefix, p.Seq[i]))
		case p.Suffix != "" && p.Prefix == "":
			labels = append(labels, fmt.Sprintf("%s%s", p.Seq[i], p.Suffix))
		case p.Suffix == "" && p.Prefix == "":
			labels = append(labels, p.Seq[i])
		default:
			labels = append(labels, fmt.Sprintf("%s%s%s", p.Prefix, p.Seq[i], p.Suffix))
		}
	}
	return labels
}
875979
func (m *VideoMessage) WithQuickReplies(items *QuickReplyItems) SendingMessage {
	m.quickReplyitems = items
	return m
}