// Sum implements our Service interface.
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
}
241510
func Sum256(data []byte) (digest [32]byte) {
	h := New256()
	h.Write(data)
	h.Sum(digest[:0])
	return
}
1303350
func Sum(data []byte) [Size]byte {
	imo := New()
	return imo.Sum(data)
}
1208008
func (p *Hash) Sum(b []byte) []byte {
	var out [TagSize]byte
	h := p.h

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

		update(buf[:], finalBlock, &h, &(p.r))
	}

	finalize(&out, &h, &(p.s))
	p.done = true
	return append(b, out[:]...)
}
785848
func (session *Session) SumInt(bean interface{}, columnName string) (res int64, err error) {
	return res, session.sum(&res, bean, columnName)
}
291040
func (xxh xxHash) Sum(b []byte) []byte {
	h64 := xxh.Sum64()
	return append(b, byte(h64), byte(h64>>8), byte(h64>>16), byte(h64>>24), byte(h64>>32), byte(h64>>40), byte(h64>>48), byte(h64>>56))
}
1042718
func Sum(out *[TagSize]byte, msg []byte, key *[16]byte) {
	(*[1]uint64)(unsafe.Pointer(&out[0]))[0] = Sum64(msg, key)
}
719138
func (m *MockMath) Sum(arg0, arg1 int) int {
	m.ctrl.T.Helper()
	ret := m.ctrl.Call(m, "Sum", arg0, arg1)
	ret0, _ := ret[0].(int)
	return ret0
}
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)
}
846462
func Sum(msg []byte, key [32]byte) [TagSize]byte {
	if len(msg) == 0 {
		msg = []byte{}
	}
	var out [TagSize]byte
	if useAVX2 && len(msg) > 8*TagSize {
		var state [512]byte
		initializeAVX2(&state, &key)
		updateAVX2(&state, msg)
		finalizeAVX2(&out, &state)
	} else {
		var state [7]uint64 // := uint64{ h0, h1, h2, r0, r1, pad0, pad1 }
		initialize(&state, &key)
		update(&state, msg)
		finalize(&out, &state)
	}
	return out
}
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
}
1287392
func (x Vector) Sum() float64 {
	s := 0.0
	for _, v := range x {
		s += v
	}
	return s
}
1152313
func Sum(msg []byte, key [32]byte) [TagSize]byte {
	var (
		h, r [5]uint32
		s    [4]uint32
	)
	var out [TagSize]byte

	initialize(&r, &s, &key)

	// process full 16-byte blocks
	n := len(msg) & (^(TagSize - 1))
	if n > 0 {
		update(msg[:n], msgBlock, &h, &r)
		msg = msg[n:]
	}
	if len(msg) > 0 {
		var block [TagSize]byte
		off := copy(block[:], msg)
		block[off] = 1
		update(block[:], finalBlock, &h, &r)
	}
	finalize(&out, &h, &s)
	return out
}
43508
func (data ChartUints) Sum(s, e int) (sum uint64) {
	if e <= s {
		return 0
	}
	for _, v := range data[s:e] {
		sum += v
	}
	return
}
258277
func (session *Session) Sums(bean interface{}, columnNames ...string) ([]float64, error) {
	var res = make([]float64, len(columnNames), len(columnNames))
	return res, session.sum(&res, bean, columnNames...)
}
1225188
func SumAll(r io.ReadSeeker) (string, error) {
	h := sha1.New()
	_, err := io.Copy(h, r)
	if err != nil {
		return "", nil
	}
	return hashSum(h), nil
}
61730
func (engine *Engine) Sums(bean interface{}, colNames ...string) ([]float64, error) {
	session := engine.NewSession()
	defer session.Close()
	return session.Sums(bean, colNames...)
}