// unitOp iter the bitset unit, apply function to each unit
197815
func (s *Bitset) unitOp(f func(*Bitset, int)) *Bitset {
	for i, n := 0, len(s.set); i < n; i++ {
		f(s, i)
	}

	return s
}
424034
func (s *Bitset) Union(b *Bitset) *Bitset {
	return s.bitsetOp(
		b,

		func(s, b *Bitset, length *uint) {
			bl, l := s.Length(0), *length

			if bl < l {
				s.unsetTop()
				s.Length(l)
			} else if bl > l {
				b.unsetTop()
			}
		},

		func(s, b *Bitset, index uint) {
			s.set[index] |= b.set[index]
		},
	)
}
994177
func (p *Parser) parseOperator() (op Operator, err error) {
	tok, lit := p.consume(KeyAndOperator)
	switch tok {
	// DoesNotExistToken shouldn't be here because it's a unary operator, not a binary operator
	case InToken:
		op = InOperator
	case EqualsToken:
		op = EqualsOperator
	case DoubleEqualsToken:
		op = DoubleEqualsOperator
	case NotInToken:
		op = NotInOperator
	case NotEqualsToken:
		op = NotEqualsOperator
	default:
		return "", fmt.Errorf("found '%s', expected: '=', '!=', '==', 'in', notin'", lit)
	}
	return op, nil
}
420595
func NewUnitOption(section, name, value string) *UnitOption {
	return &UnitOption{Section: section, Name: name, Value: value}
}
373286
func unitCount(length uint) uint {
	count := length >> unitLenLogN
	if length&(unitLen-1) != 0 {
		count++
	}

	return count
}
158612
func (c SimpleFSClient) SimpleFSGetOps(ctx context.Context) (res []OpDescription, err error) {
	err = c.Cli.Call(ctx, "keybase.1.SimpleFS.simpleFSGetOps", []interface{}{SimpleFSGetOpsArg{}}, &res)
	return
}
919037
func NewOp(op OpTensorOp, dt DataType, prop NanPropagation) (*Op, error) {
	var internal C.cudnnOpTensorDescriptor_t
	if err := result(C.cudnnCreateOpTensorDescriptor(&internal)); err != nil {
		return nil, err
	}

	if err := result(C.cudnnSetOpTensorDescriptor(internal, op.C(), dt.C(), prop.C())); err != nil {
		return nil, err
	}
	retVal := &Op{
		internal:       internal,
		op:             op,
		dataType:       dt,
		nanPropagation: prop,
	}
	runtime.SetFinalizer(retVal, destroyOp)
	return retVal, nil
}
922391
func ListGetOp(binName string, index int) *Operation {
	return &Operation{opType: _CDT_READ, binName: binName, binValue: ListValue{_CDT_LIST_GET, IntegerValue(index)}, encoder: listGenericOpEncoder}
}
695660
func (pget Pget) ErrTop(err error) error {
	for e := err; e != nil; {
		switch e.(type) {
		case ignore:
			return nil
		case cause:
			e = e.(cause).Cause()
		default:
			return e
		}
	}

	return nil
}
1112785
func inCollectionOp(key string, ids ...string) bson.D {
	ret := bson.D{}
	switch len(ids) {
	case 0:
	case 1:
		ret = append(ret, bson.DocElem{key, ids[0]})
	default:
		ret = append(ret, bson.DocElem{key, bson.D{{"$in", ids}}})
	}
	return ret
}
341619
func (a *Application) incUnitCountOp(asserts bson.D) txn.Op {
	op := txn.Op{
		C:      applicationsC,
		Id:     a.doc.DocID,
		Update: bson.D{{"$inc", bson.D{{"unitcount", 1}}}},
	}
	if len(asserts) > 0 {
		op.Assert = asserts
	}
	return op
}
557082
func ListSetOrderOp(binName string, listOrder ListOrderType) *Operation {
	return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_SET_TYPE, IntegerValue(listOrder)}, encoder: listGenericOpEncoder}
}
728406
func ListSizeOp(binName string) *Operation {
	return &Operation{opType: _CDT_READ, binName: binName, binValue: ListValue{_CDT_LIST_SIZE}, encoder: listGenericOpEncoder}
}
1267488
func (m *IntSet) Union(a int, b int) {
	m.parent[m.FindRoot(a)] = m.FindRoot(b)
}
1334460
func ListPopOp(binName string, index int) *Operation {
	return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_POP, IntegerValue(index)}, encoder: listGenericOpEncoder}
}
306510
func (set *IntSet) Init() error {
	if len(*set) > 0 {
		*set = make(map[int64]struct{})
	}
	return nil
}
1353893
func intArithOp(op string, left, right int64) (int64, error) {
	switch op {
	case opPlus:
		return left + right, nil
	case opMinus:
		return left - right, nil
	case opDivide:
		if right == 0 {
			return 0, errArithDivideByZero
		}
		return left / right, nil
	case opMultiply:
		return left * right, nil
	case opModulo:
		if right == 0 {
			return 0, errArithDivideByZero
		}
		return left % right, nil
	}
	// This does not happen
	return 0, nil
}