// BitOp implements http://redis.io/commands/bitop.
// Cannot be sharded.
503629
func (c *Client) BitOp(operation, destkey, key string, keys ...string) (int, error) {
	a := append([]string{"BITOP", operation, destkey, key}, keys...)
	v, err := c.execOnFirst(true, vstr2iface(a)...)
	if err != nil {
		return 0, err
	}
	return iface2int(v)
}
682492
func (c *Client) BitCount(key string, start, end int) (int, error) {
	var (
		v   interface{}
		err error
	)
	if start > -1 {
		v, err = c.execWithKey(true, "BITCOUNT", key, start, end)
	} else {
		v, err = c.execWithKey(true, "BITCOUNT", key)
	}
	if err != nil {
		return 0, err
	}
	return iface2int(v)
}
564011
func (b *Bitset) Get(index int) int {
	if index < b.size {
		return b.bits[index]
	}
	return -1
}
1327462
func (nsLife_) dyingOp(entities mongo.Collection, docID string) (txn.Op, error) {
	op, err := nsLife.checkOp(entities, docID, nsLife.dying())
	switch errors.Cause(err) {
	case nil:
	case errCheckFailed:
		return txn.Op{}, errNotDying
	default:
		return txn.Op{}, errors.Trace(err)
	}
	return op, nil
}
705551
func (b *Bitmap) writeOp(op *op) error {
	if b.OpWriter == nil {
		return nil
	}

	if _, err := op.WriteTo(b.OpWriter); err != nil {
		return err
	}
	b.opN += op.count()

	return nil
}
598403
func ListSortOp(binName string, sortFlags int) *Operation {
	return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_SORT, IntegerValue(sortFlags)}, encoder: listGenericOpEncoder}
}
58079
func (s *Bitset) BitCount() int {
	var n int
	s.unsetTop()
	for i, l := 0, len(s.set); i < l; i++ {
		n += BitCount(s.set[i])
	}

	return n
}
47036
func unaryOpCpsoct(rate int8, in Input, numOutputs int) Input {
	CheckRate(rate)
	return NewInput(UnaryOpUgenName, rate, UnaryOpCpsoct, numOutputs, in)
}
1103256
func (c *syncClient) Lpop(arg0 string) (result []byte, err Error) {
	arg0bytes := []byte(arg0)

	var resp Response
	resp, err = c.conn.ServiceRequest(&LPOP, [][]byte{arg0bytes})
	if err == nil {
		result = resp.GetBulkData()
	}
	return result, err

}
626363
func (r *Redis) BitCount(key string, start, end int) (int64, error) {
	rp, err := r.ExecuteCommand("BITCOUNT", key, start, end)
	if err != nil {
		return 0, err
	}
	return rp.IntegerValue()
}
559808
func (c *Client) Noop() (err error) {
	res := struct {
		Status string `xmlrpc:"status"`
	}{}
	err = c.Call("NoOperation", []interface{}{c.Token}, &res)
	if err == nil && res.Status != StatusSuccess {
		err = fmt.Errorf("NoOp: %s", res.Status)
	}
	return
}
765827
func (db *RedisDB) Lpop(k string) (string, error) {
	db.master.Lock()
	defer db.master.Unlock()

	if !db.exists(k) {
		return "", ErrKeyNotFound
	}
	if db.t(k) != "list" {
		return "", ErrWrongType
	}
	return db.listLpop(k), nil
}
1118811
func (bf BitField) All(val bool) bool {
	targ := bf.size
	if !val {
		targ = 0
	}
	return bf.CountSet() == targ
}
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
}
411934
func AppendOp(bin *Bin) *Operation {
	return &Operation{opType: _APPEND, binName: bin.Name, binValue: bin.Value}
}
1345040
func (pr *Reader) BitsRead() int64 {
	offset := 8*pr.Offset - int64(pr.numBits)
	if pr.bufRd != nil {
		discardBits := pr.discardBits + int(pr.fedBits-pr.numBits)
		offset = 8*pr.Offset + int64(discardBits)
	}
	return offset
}
135602
func (b *Bitmap) Bit(index int) bool {
	byteIndex := index / 8
	bitMask := byte(1 << (uint(index) & 0x7))
	return b.data[byteIndex]&bitMask > 0
}