// Sum returns the sum of two trits.
349200
func Sum(a int8, b int8) int8 {
	s := a + b

	switch s {
	case 2:
		return -1
	case -2:
		return 1
	default:
		return s
	}
}
174975
func (d *digest) Sum(in []byte) []byte {
	// Make a copy of the original hash so that caller can keep writing and summing.
	dup := *d
	dup.finalize()
	return dup.squeeze(in, dup.outputSize)
}
1263142
func SumInt(s []int) (sum int) {
	for _, v := range s {
		sum += v
	}
	return
}
1090732
func (vec *T) Add(v *T) *T {
	if v[3] == vec[3] {
		vec[0] += v[0]
		vec[1] += v[1]
		vec[2] += v[2]
	} else {
		vec.DividedByW()
		v3 := v.Vec3DividedByW()
		vec[0] += v3[0]
		vec[1] += v3[1]
		vec[2] += v3[2]
	}
	return vec
}
1284900
func (r *Number) Sum(now time.Time) float64 {
	sum := float64(0)

	r.Mutex.RLock()
	defer r.Mutex.RUnlock()

	for timestamp, bucket := range r.Buckets {
		// TODO: configurable rolling window
		if timestamp >= now.Unix()-10 {
			sum += bucket.Value
		}
	}

	return sum
}
661000
func (session *Session) Sum(bean interface{}, columnName string) (float64, error) {
	defer session.resetStatement()
	if session.IsAutoClose {
		defer session.Close()
	}

	var sqlStr string
	var args []interface{}
	if len(session.Statement.RawSQL) == 0 {
		sqlStr, args = session.Statement.genSumSQL(bean, columnName)
	} else {
		sqlStr = session.Statement.RawSQL
		args = session.Statement.RawParams
	}

	session.queryPreprocess(&sqlStr, args...)

	var err error
	var res float64
	if session.IsAutoCommit {
		err = session.DB().QueryRow(sqlStr, args...).Scan(&res)
	} else {
		err = session.Tx.QueryRow(sqlStr, args...).Scan(&res)
	}
	if err != nil {
		return 0, err
	}

	return res, nil
}
879845
func (p *Hash) Sum(out *[TagSize]byte) {
	h, r := p.h, p.r
	pad := p.pad

	if p.off > 0 {
		var buf [TagSize]byte
		copy(buf[:], p.buf[:p.off])
		buf[p.off] = 1 // invariant: p.off < TagSize

		core(buf[:], finalBlock, &h, &r)
	}

	finalize(out, &h, &pad)
	p.done = true
}
799168
func (r *Rollsum32) Sum(b []byte) []byte {
	if b != nil && cap(b)-len(b) >= 4 {
		p := len(b)
		b = b[:len(b)+4]
		r.Rollsum32Base.GetSum(b[p:])
		return b
	} else {
		result := []byte{0, 0, 0, 0}
		r.Rollsum32Base.GetSum(result)
		return append(b, result...)
	}
}
1042718
func Sum(out *[TagSize]byte, msg []byte, key *[16]byte) {
	(*[1]uint64)(unsafe.Pointer(&out[0]))[0] = Sum64(msg, key)
}
1050233
func (s *asmState) Sum(b []byte) []byte {
	if s.outputLen == 0 {
		panic("sha3: cannot call Sum on SHAKE functions")
	}

	// Copy the state to preserve the original.
	a := s.a

	// Hash the buffer. Note that we don't clear it because we
	// aren't updating the state.
	klmd(s.function, &a, nil, s.buf)
	return append(b, a[:s.outputLen]...)
}
542565
func (s *svc2) Sum(ctx context.Context, a int64, b int64) (int64, error) {
	// We love starting up slow
	time.Sleep(5 * time.Millisecond)

	// Pull span from context.
	span := opentracing.SpanFromContext(ctx)

	// Example binary annotations.
	span.SetTag("service", "svc2")
	span.SetTag("string", "some value")
	span.SetTag("int", 123)
	span.SetTag("bool", true)

	// Example annotation
	span.LogEvent("MyEventAnnotation")

	// Let's wait a little so it shows up nicely in our tracing graphics.
	time.Sleep(10 * time.Millisecond)

	// Let's assume we want to trace a call we do to a database.
	s.fakeDBCall(span)

	// Check for Int overflow condition.
	if (b > 0 && a > (Int64Max-b)) || (b < 0 && a < (Int64Min-b)) {
		span.SetTag("error", ErrIntOverflow.Error())
		return 0, ErrIntOverflow
	}

	// calculate and return the result (all that boilerplate for this?) ;)
	return a + b, nil
}
370573
func (d *State364) Sum(b []byte) []byte {
	d.pc, d.pb = Jenkins364(d.tail, len(d.tail), d.pc, d.pb)
	d.hash = uint64(d.pb<<32) | uint64(d.pc)
	h := d.hash
	return append(b, byte(h>>56), byte(h>>48), byte(h>>40), byte(h>>32), byte(h>>24), byte(h>>16), byte(h>>8), byte(h))
}
422404
func Sum(msg []byte, hashsize int, conf *Config) []byte {
	s := New(hashsize, conf)
	s.Write(msg)
	return s.Sum(nil)
}
1238253
func Sum(xs []float64) float64 {
	sum := 0.0
	for _, x := range xs {
		sum += x
	}
	return sum
}
1357498
func (a Aggregations) Sum(name string) (*AggregationValueMetric, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationValueMetric)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
775674
func (mr *MockMathMockRecorder) Sum(arg0, arg1 interface{}) *gomock.Call {
	mr.mock.ctrl.T.Helper()
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Sum", reflect.TypeOf((*MockMath)(nil).Sum), arg0, arg1)
}
253966
func (session *Session) Sum(bean interface{}, columnName string) (res float64, err error) {
	return res, session.sum(&res, bean, columnName)
}