// binOpAdd creates a BinaryOpUGen that represents addition.
174776
func binOpAdd(rate int8, x, y Input, numOutputs int) Input {
	CheckRate(rate)
	return NewInput(BinOpUgenName, rate, BinOpAdd, numOutputs, x, y)
}
840618
func int64Add(a, b int64) (int64, bool) {
	c := a + b
	switch {
	case a > 0 && b > 0:
		if c < 0 {
			return 0, false
		}
	case a < 0 && b < 0:
		if c > 0 {
			return 0, false
		}
		if a == mostNegative && b == mostNegative {
			return 0, false
		}
	}
	return c, true
}
202740
func binOpThresh(rate int8, x, y Input, numOutputs int) Input {
	CheckRate(rate)
	return NewInput(BinOpUgenName, rate, BinOpThresh, numOutputs, x, y)
}
288200
func (bs Binaries) Find(id int) *Binary {
	for i := range bs {
		if bs[i].ID == id {
			return &bs[i]
		}
	}
	return nil
}
803816
func binOpMul(rate int8, x, y Input, numOutputs int) Input {
	CheckRate(rate)
	return NewInput(BinOpUgenName, rate, BinOpMul, numOutputs, x, y)
}
1127066
func (b *bdpEstimator) add(n uint32) bool {
	b.mu.Lock()
	defer b.mu.Unlock()
	if b.bdp == bdpLimit {
		return false
	}
	if !b.isSent {
		b.isSent = true
		b.sample = n
		b.sentAt = time.Time{}
		b.sampleCount++
		return true
	}
	b.sample += n
	return false
}
535793
func BinaryID(v checked.Bytes) ID {
	v.IncRef()
	return &id{data: v}
}
1196534
func (c *asyncClient) Zadd(arg0 string, arg1 float64, arg2 []byte) (result FutureBool, err Error) {
	arg0bytes := []byte(arg0)
	arg1bytes := []byte(fmt.Sprintf("%e", arg1))
	arg2bytes := arg2

	var resp *PendingResponse
	resp, err = c.conn.QueueRequest(&ZADD, [][]byte{arg0bytes, arg1bytes, arg2bytes})
	if err == nil {
		result = resp.future.(FutureBool)
	}
	return result, err

}
1047803
func (d *Datum) SetBinaryLiteral(b BinaryLiteral) {
	d.k = KindBinaryLiteral
	d.b = b
}
479658
func (u *Ugen) Add(val Input) Input {
	return binOpAdd(u.Rate, u, val, u.NumOutputs)
}
1060649
func binOpModulo(rate int8, x, y Input, numOutputs int) Input {
	CheckRate(rate)
	return NewInput(BinOpUgenName, rate, BinOpModulo, numOutputs, x, y)
}
14184
func binOpHypotApx(rate int8, x, y Input, numOutputs int) Input {
	CheckRate(rate)
	return NewInput(BinOpUgenName, rate, BinOpHypotApx, numOutputs, x, y)
}
775467
func (c *Compiler) pushBin(v interface{}) {
	if c.debug {
		fmt.Printf("%d: %v\n", len(c.binary), v)
	}
	c.binary = append(c.binary, v)
}
1276983
func binOpGTE(rate int8, x, y Input, numOutputs int) Input {
	CheckRate(rate)
	return NewInput(BinOpUgenName, rate, BinOpGTE, numOutputs, x, y)
}
959435
func binOpLTE(rate int8, x, y Input, numOutputs int) Input {
	CheckRate(rate)
	return NewInput(BinOpUgenName, rate, BinOpLTE, numOutputs, x, y)
}
516398
func (p *parser) parseBinaryOps(ops []map[scanner.TokenType]ast.ArithmeticOp) (ast.Node, error) {
	if len(ops) == 0 {
		// We've run out of operators, so now we'll just try to parse a term.
		return p.ParseExpressionTerm()
	}

	thisLevel := ops[0]
	remaining := ops[1:]

	startPos := p.peeker.Peek().Pos

	var lhs, rhs ast.Node
	operator := ast.ArithmeticOpInvalid
	var err error

	// parse a term that might be the first operand of a binary
	// expression or it might just be a standalone term, but
	// we won't know until we've parsed it and can look ahead
	// to see if there's an operator token.
	lhs, err = p.parseBinaryOps(remaining)
	if err != nil {
		return nil, err
	}

	// We'll keep eating up arithmetic operators until we run
	// out, so that operators with the same precedence will combine in a
	// left-associative manner:
	// a+b+c => (a+b)+c, not a+(b+c)
	//
	// Should we later want to have right-associative operators, a way
	// to achieve that would be to call back up to ParseExpression here
	// instead of iteratively parsing only the remaining operators.
	for {
		next := p.peeker.Peek()
		var newOperator ast.ArithmeticOp
		var ok bool
		if newOperator, ok = thisLevel[next.Type]; !ok {
			break
		}

		// Are we extending an expression started on
		// the previous iteration?
		if operator != ast.ArithmeticOpInvalid {
			lhs = &ast.Arithmetic{
				Op:    operator,
				Exprs: []ast.Node{lhs, rhs},
				Posx:  startPos,
			}
		}

		operator = newOperator
		p.peeker.Read() // eat operator token
		rhs, err = p.parseBinaryOps(remaining)
		if err != nil {
			return nil, err
		}
	}

	if operator != ast.ArithmeticOpInvalid {
		return &ast.Arithmetic{
			Op:    operator,
			Exprs: []ast.Node{lhs, rhs},
			Posx:  startPos,
		}, nil
	} else {
		return lhs, nil
	}
}
69490
func (ctx *context) Binary(data []byte) (int, error) {
	ctx.ContentType(ContentBinaryHeaderValue)
	return ctx.Write(data)
}