// -------------------------------------------------------------------------- d
168459
func (l *d) mvL(r *d, c int) {
	copy(l.d[l.c:], r.d[:c])
	copy(r.d[:], r.d[c:r.c])
	// Zero out the de's here to prevent reading bad data
	// and to avoid creating non-collectible (GC) references.
	for i := 1; i < c; i++ {
		r.d[r.c-i] = zde
	}
	l.c += c
	r.c -= c
}
472839
func (s *DeleteByQueryService) DF(defaultField string) *DeleteByQueryService {
	s.df = defaultField
	return s
}
619703
func HTMLLine(d *DiffSolution) (string, string) {
	a := &bytes.Buffer{}
	b := &bytes.Buffer{}
	for _, word := range d.Lines {
		switch LineSource(word[2]) {
		case LineFromA:
			span.Execute(a, elem{"w-add", word[0]})
			span.Execute(b, elem{"w-del", ""})
		case LineFromB:
			span.Execute(a, elem{"w-del", ""})
			span.Execute(b, elem{"w-add", word[1]})
		case LineFromBothEdit:
			span.Execute(a, elem{"w-edit", word[0]})
			span.Execute(b, elem{"w-edit", word[1]})
		case LineFromBoth:
			a.WriteString(template.HTMLEscapeString(word[0]))
			b.WriteString(template.HTMLEscapeString(word[1]))
		}
	}
	return a.String(), b.String()
}
1012604
func (self *Temp) Id() string {
	return fmt.Sprintf("%02x:%02x", self.id>>8, self.id&0xff)
}
326257
func (id EventID) Format(s string, args ...interface{}) string {
	args = append([]interface{}{id.String()}, args...)
	return fmt.Sprintf(s, args...)
}
564534
func ToDelimited(s string, del uint8) string {
	return ToScreamingDelimited(s, del, false)
}
1247799
func (this *LRUCache) CompressAndAdd(key interface{}, value []byte, compressor Compressor) {
	this.locker.Lock()
	defer this.locker.Unlock()

	defer func() {
		// 避免 cache 中对象被 gc
		if err := recover(); err != nil {
			logger.Errorln("lru RemoveOldest panic:", err)
		}
	}()

	if err := compressor.Compress(value); err != nil {
		return
	}

	this.Cache.Add(lru.Key(key), compressor)
}
1108061
func (c C) MulAdd(mul, add Input) Input {
	if m, mok := mul.(C); mok {
		if a, aok := add.(C); aok {
			return C((float32(m) * float32(c)) + float32(a))
		}
		return add.MulAdd(c, mul)
	}
	return mul.MulAdd(c, add)
}
741192
func (s *UpdateByQueryService) DF(df string) *UpdateByQueryService {
	s.df = df
	return s
}
49076
func Cached(d string) {
	if r, ok := relationalModelDefinition(false); ok {
		r.Cached = true
		dur, err := strconv.Atoi(d)
		if err != nil {
			dslengine.ReportError("Duration %s couldn't be parsed as integer", d)
		}
		r.CacheDuration = dur
	}
}
377836
func (d *Decl) Add(subDecl *Decl) {
	d.Decl = append(d.Decl, subDecl)
}
516045
func docsDefinition() (*design.DocsDefinition, bool) {
	a, ok := dslengine.CurrentDefinition().(*design.DocsDefinition)
	if !ok {
		dslengine.IncompatibleDSL()
	}
	return a, ok
}
360679
func parseDUID(p []byte) (DUID, error) {
	b := buffer.New(p)
	// DUID must have enough bytes to determine its type
	if b.Len() < 2 {
		return nil, io.ErrUnexpectedEOF
	}

	var d DUID
	switch DUIDType(b.Read16()) {
	case DUIDTypeLLT:
		d = new(DUIDLLT)
	case DUIDTypeEN:
		d = new(DUIDEN)
	case DUIDTypeLL:
		d = new(DUIDLL)
	case DUIDTypeUUID:
		d = new(DUIDUUID)
	default:
		return nil, errUnknownDUID
	}

	return d, d.UnmarshalBinary(p)
}
560516
func (ai *AtomicInt) GetAndAdd(delta int) int {
	newVal := atomic.AddInt64(&ai.val, int64(delta))
	res := int(newVal - int64(delta))
	return res
}
890929
func MysqlAddr(tablet *topodatapb.Tablet) string {
	return fmt.Sprintf("%v:%v", MysqlHostname(tablet), MysqlPort(tablet))
}
592536
func (views *views) onDead() {
	views.isDead = true

	ball := views.ball

	dx := ball.getSpeed() * math.Cos(ball.getDirection()*math.Pi/180)
	dy := float64(0)
	dx -= 3
	ball.setSpeed(math.Sqrt(dx*dx + dy*dy))
	ball.setDirection(math.Atan2(dy, dx) * 180 / math.Pi)
}
1353587
func (d Decoder) Decode() (interface{}, error) {
	data, err := d.read()
	if err != nil {
		return nil, err
	}

	return d.decode(data)
}