// NewMaxOrMinDec returns the max or min value decimal for given precision and fraction.
195808
func NewMaxOrMinDec(negative bool, prec, frac int) *MyDecimal {
	str := make([]byte, prec+2)
	for i := 0; i < len(str); i++ {
		str[i] = '9'
	}
	if negative {
		str[0] = '-'
	} else {
		str[0] = '+'
	}
	str[1+prec-frac] = '.'
	dec := new(MyDecimal)
	dec.FromString(str)
	return dec
}
454332
func (s *InputSpecification) SetMaximumBitrate(v string) *InputSpecification {
	s.MaximumBitrate = &v
	return s
}
753960
func (s *Limits) SetMaximumPartitionCount(v int64) *Limits {
	s.MaximumPartitionCount = &v
	return s
}
114452
func NextMinus(z, x *decimal.Big) *decimal.Big {
	if z.CheckNaNs(x, nil) {
		return z
	}

	if x.IsInf(0) {
		if x.IsInf(-1) {
			return z.SetInf(true)
		}
		_, m := decimal.Raw(z)
		maxfor(m, precision(z), +1)
		return z.SetBigMantScale(m, -etop(z))
	}

	ctx := z.Context
	ctx.RoundingMode = decimal.ToNegativeInf
	ctx.Set(z, x)
	ctx.Sub(z, x, new(decimal.Big).SetMantScale(1, -etiny(z)+1))
	z.Context.Conditions &= ctx.Conditions
	return z
}
1254963
func NewNumericRangeQuery(min, max *float64) *NumericRangeQuery {
	return NewNumericRangeInclusiveQuery(min, max, nil, nil)
}
1263379
func NewMinMaxAllocator(min, max int) (*MinMaxAllocator, error) {
	if min > max {
		return nil, ErrInvalidRange
	}
	return &MinMaxAllocator{
		min:  min,
		max:  max,
		free: 1 + max - min,
		used: map[int]bool{},
	}, nil
}
46867
func NewNumericRangeQuery(min, max *float64) *query.NumericRangeQuery {
	return query.NewNumericRangeQuery(min, max)
}
1363530
func NewInt64Ptr(val int64) *int64 {
	ptrValue := new(int64)
	*ptrValue = val
	return ptrValue
}
1133588
func (s *CorsRule) SetMaxAgeSeconds(v int64) *CorsRule {
	s.MaxAgeSeconds = &v
	return s
}
639949
func NewMAX7219Driver(a gobot.Connection, clockPin string, dataPin string, csPin string, count uint) *MAX7219Driver {
	t := &MAX7219Driver{
		name:       gobot.DefaultName("MAX7219Driver"),
		pinClock:   NewDirectPinDriver(a, clockPin),
		pinData:    NewDirectPinDriver(a, dataPin),
		pinCS:      NewDirectPinDriver(a, csPin),
		count:      count,
		connection: a,
		Commander:  gobot.NewCommander(),
	}

	/* TODO : Add commands */

	return t
}
491623
func NewRestriction(keyAllowed bool, maxValueLength int) *Restriction {
	return &Restriction{
		keyAllowed:     keyAllowed,
		maxValueLength: maxValueLength,
	}
}
1068856
func (s *AccountAttribute) SetMaximum(v int64) *AccountAttribute {
	s.Maximum = &v
	return s
}
407656
func (s *ListOfferingsInput) SetMaximumBitrate(v string) *ListOfferingsInput {
	s.MaximumBitrate = &v
	return s
}
807934
func NewMaxScoreIterator(ctx Context, source RankIterator) *MaxScoreIterator {
	iter := &MaxScoreIterator{
		ctx:    ctx,
		source: source,
	}
	return iter
}
770092
func newMruInventoryMap(limit uint) *mruInventoryMap {
	m := mruInventoryMap{
		invMap:  make(map[wire.InvVect]*list.Element),
		invList: list.New(),
		limit:   limit,
	}
	return &m
}
635163
func NewNetem(attrs QdiscAttrs, nattrs NetemQdiscAttrs) *Netem {
	var limit uint32 = 1000
	var lossCorr, delayCorr, duplicateCorr uint32
	var reorderProb, reorderCorr uint32
	var corruptProb, corruptCorr uint32

	latency := nattrs.Latency
	loss := Percentage2u32(nattrs.Loss)
	gap := nattrs.Gap
	duplicate := Percentage2u32(nattrs.Duplicate)
	jitter := nattrs.Jitter

	// Correlation
	if latency > 0 && jitter > 0 {
		delayCorr = Percentage2u32(nattrs.DelayCorr)
	}
	if loss > 0 {
		lossCorr = Percentage2u32(nattrs.LossCorr)
	}
	if duplicate > 0 {
		duplicateCorr = Percentage2u32(nattrs.DuplicateCorr)
	}
	// FIXME should validate values(like loss/duplicate are percentages...)
	latency = time2Tick(latency)

	if nattrs.Limit != 0 {
		limit = nattrs.Limit
	}
	// Jitter is only value if latency is > 0
	if latency > 0 {
		jitter = time2Tick(jitter)
	}

	reorderProb = Percentage2u32(nattrs.ReorderProb)
	reorderCorr = Percentage2u32(nattrs.ReorderCorr)

	if reorderProb > 0 {
		// ERROR if lantency == 0
		if gap == 0 {
			gap = 1
		}
	}

	corruptProb = Percentage2u32(nattrs.CorruptProb)
	corruptCorr = Percentage2u32(nattrs.CorruptCorr)

	return &Netem{
		QdiscAttrs:    attrs,
		Latency:       latency,
		DelayCorr:     delayCorr,
		Limit:         limit,
		Loss:          loss,
		LossCorr:      lossCorr,
		Gap:           gap,
		Duplicate:     duplicate,
		DuplicateCorr: duplicateCorr,
		Jitter:        jitter,
		ReorderProb:   reorderProb,
		ReorderCorr:   reorderCorr,
		CorruptProb:   corruptProb,
		CorruptCorr:   corruptCorr,
	}
}
255451
func NewAttemptAbnormalFinish(af *AbnormalFinish) *Attempt {
	return &Attempt{
		Data: &Attempt_Data{
			AttemptType: &Attempt_Data_AbnormalFinish{af}}}
}