// Updates the size of the data returned by Rread. Expects that
// the Fcall value is already initialized by InitRread.
514081
func SetRreadCount(fc *Fcall, count uint32) {
	/* we need to update both the packet size as well as the data count */
	size := 4 + 1 + 2 + 4 + count /* size[4] id[1] tag[2] count[4] data[count] */
	pint32(size, fc.Pkt)
	pint32(count, fc.Pkt[7:])
	fc.Size = size
	fc.Count = count
	fc.Pkt = fc.Pkt[0:size]
	fc.Data = fc.Data[0:count]
	fc.Size = size
}
667744
func (b *Writer) updateWidth() {
	cesc := regexp.MustCompile(`\x1b\[\d+(;\d+)*m`)
	tempStr := b.buf.Bytes()[b.pos:b.buf.Len()]

	b.cell.width += utf8.RuneCount(cesc.ReplaceAll(tempStr, []byte("")))
	b.pos = b.buf.Len()
}
302245
func (a *Allocated) Update() {
	a.m.Lock()
	defer a.m.Unlock()

	runtime.ReadMemStats(&a.mem)
	a.g.Update(int64(a.mem.Alloc))
}
1076242
func (ls *LengthSlice) Update(slice []byte) {
	binary.BigEndian.PutUint32(slice, uint32(len(slice)-ls.GetReserveLength()))
}
861583
func NewBufReaderAt(readerAt io.ReaderAt, size int) *BufReaderAt {
	if size < minBufferSize {
		size = minBufferSize
	}

	return &BufReaderAt{
		offset:     0,
		readerAt:   readerAt,
		buf:        make([]byte, size),
		sizeTilEOF: sizeNotInitialized,
	}
}
799915
func (c SimpleFSClient) SimpleFSRead(ctx context.Context, __arg SimpleFSReadArg) (res FileContent, err error) {
	err = c.Cli.Call(ctx, "keybase.1.SimpleFS.simpleFSRead", []interface{}{__arg}, &res)
	return
}
940121
func (a *addrBook) Size() int {
	a.mtx.Lock()
	defer a.mtx.Unlock()

	return a.size()
}
1210559
func NewFcall(sz uint32) *Fcall {
	fc := new(Fcall)
	fc.Buf = make([]byte, sz)

	return fc
}
475912
func (f *File) updateDead(node ast.Node) {
	if f.dead[node] {
		// The node is already marked as dead.
		return
	}

	switch stmt := node.(type) {
	case *ast.IfStmt:
		// "if" branch is dead if its condition evaluates
		// to constant false.
		v := f.pkg.types[stmt.Cond].Value
		if v == nil {
			return
		}
		if !constant.BoolVal(v) {
			f.setDead(stmt.Body)
			return
		}
		f.setDead(stmt.Else)
	case *ast.SwitchStmt:
		// Case clause with empty switch tag is dead if it evaluates
		// to constant false.
		if stmt.Tag == nil {
		BodyLoopBool:
			for _, stmt := range stmt.Body.List {
				cc := stmt.(*ast.CaseClause)
				if cc.List == nil {
					// Skip default case.
					continue
				}
				for _, expr := range cc.List {
					v := f.pkg.types[expr].Value
					if v == nil || constant.BoolVal(v) {
						continue BodyLoopBool
					}
				}
				f.setDead(cc)
			}
			return
		}

		// Case clause is dead if its constant value doesn't match
		// the constant value from the switch tag.
		// TODO: This handles integer comparisons only.
		v := f.pkg.types[stmt.Tag].Value
		if v == nil || v.Kind() != constant.Int {
			return
		}
		tagN, ok := constant.Uint64Val(v)
		if !ok {
			return
		}
	BodyLoopInt:
		for _, x := range stmt.Body.List {
			cc := x.(*ast.CaseClause)
			if cc.List == nil {
				// Skip default case.
				continue
			}
			for _, expr := range cc.List {
				v := f.pkg.types[expr].Value
				if v == nil {
					continue BodyLoopInt
				}
				n, ok := constant.Uint64Val(v)
				if !ok || tagN == n {
					continue BodyLoopInt
				}
			}
			f.setDead(cc)
		}
	}
}
663905
func (s *sessionV8) NewDataReader() io.Reader {
	// DataFP is always intitialized, either via new or load functions.
	s.DataFP.Seek(0, os.SEEK_SET)
	return io.Reader(s.DataFP)
}
872484
func (m *Mallocs) Update() {
	m.m.Lock()
	defer m.m.Unlock()

	runtime.ReadMemStats(&m.mem)
	m.d.Update(int64(m.mem.Mallocs))
}
706994
func (f *File) SetAllocationSize(ctx context.Context, fi *dokan.FileInfo, newSize int64) (err error) {
	f.folder.fs.logEnter(ctx, "File SetAllocationSize")
	defer func() { f.folder.reportErr(ctx, libkbfs.WriteMode, err) }()

	ei, err := f.folder.fs.config.KBFSOps().Stat(ctx, f.node)
	if err != nil {
		return err
	}

	// Refuse to grow the file.
	if int64(ei.Size) <= newSize {
		return nil
	}

	return f.folder.fs.config.KBFSOps().Truncate(ctx, f.node, uint64(newSize))
}
630849
func (rs *Set) Size() (int64, error) {
	conn := rs.pool.Get(rs.dbindex)
	size, err := conn.Do("SCARD", rs.id)
	if err != nil {
		panic(err)
	}
	return redis.Int64(size, err)
}
1053051
func (r *stringReader) update() {
	pos, _ := r.Seek(0, io.SeekCurrent)
	if off := pos - r.pos; off >= 0 && off < int64(len(r.buf)) {
		r.buf, r.pos = r.buf[off:], pos
	} else {
		r.buf, r.pos = nil, pos
	}
}
673904
func Init(r io.ReaderAt) (*FS, error) {
	fs := &FS{
		r:         r,
		buf:       make([]byte, 1024),
		BlockSize: superSize,
	}

	var super diskSuper
	if _, err := fs.read(superOff, 0, &super); err != nil {
		return nil, err
	}

	if super.Magic != superMagic {
		return nil, fmt.Errorf("bad magic %#x wanted %#x", super.Magic, superMagic)
	}

	bsize := uint32(minBlockSize << super.Logblocksize)
	fs.BlockSize = int(bsize)
	fs.NumBlock = int64(super.Nblock)
	fs.numGroup = (super.Nblock + super.Blockspergroup - 1) / super.Blockspergroup
	fs.g = make([]*diskGroup, fs.numGroup)
	fs.inodesPerGroup = super.Inospergroup
	fs.blocksPerGroup = super.Blockspergroup
	if super.Revlevel >= 1 {
		fs.inodeSize = uint32(super.Inosize)
	} else {
		fs.inodeSize = 128
	}
	fs.inodesPerBlock = bsize / fs.inodeSize
	if bsize == superOff {
		fs.groupAddr = 2
	} else {
		fs.groupAddr = 1
	}
	fs.descPerBlock = bsize / diskGroupSize
	fs.firstBlock = super.Firstdatablock

	return fs, nil
}
282117
func NewRegretableReaderCloserSize(rc io.ReadCloser, size int) *RegretableReaderCloser {
	return &RegretableReaderCloser{*NewRegretableReaderSize(rc, size), rc}
}
750231
func (b *AnnealingEpsilonGreedy) Init(nArms int) {
	b.counts = make([]uint64, nArms, nArms)
	b.values = make([]float64, nArms, nArms)
}