Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 25 for readVarint (0.18 sec)

  1. src/encoding/binary/varint_test.go

    	if string(buf2) != "prefix"+string(buf[:n]) {
    		t.Errorf("AppendVarint(%d): got %q, want %q", x, buf2, "prefix"+string(buf[:n]))
    	}
    
    	y, err := ReadVarint(bytes.NewReader(buf))
    	if err != nil {
    		t.Errorf("ReadVarint(%d): %s", x, err)
    	}
    	if x != y {
    		t.Errorf("ReadVarint(%d): got %d", x, y)
    	}
    }
    
    func testUvarint(t *testing.T, x uint64) {
    	buf := make([]byte, MaxVarintLen64)
    	n := PutUvarint(buf, x)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 16 23:09:19 UTC 2023
    - 5.5K bytes
    - Viewed (0)
  2. src/internal/reflectlite/type.go

    		}
    	}
    }
    
    func (n name) name() string {
    	if n.bytes == nil {
    		return ""
    	}
    	i, l := n.readVarint(1)
    	return unsafe.String(n.data(1+i, "non-empty string"), l)
    }
    
    func (n name) tag() string {
    	if !n.hasTag() {
    		return ""
    	}
    	i, l := n.readVarint(1)
    	i2, l2 := n.readVarint(1 + i + l)
    	return unsafe.String(n.data(1+i+l+i2, "non-empty string"), l2)
    }
    
    func pkgPath(n abi.Name) string {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 07 17:01:54 UTC 2024
    - 16.2K bytes
    - Viewed (0)
  3. src/encoding/binary/varint.go

    		s += 7
    	}
    	return x, errOverflow
    }
    
    // ReadVarint reads an encoded signed integer from r and returns it as an int64.
    // The error is [io.EOF] only if no bytes were read.
    // If an [io.EOF] happens after reading some but not all the bytes,
    // ReadVarint returns [io.ErrUnexpectedEOF].
    func ReadVarint(r io.ByteReader) (int64, error) {
    	ux, err := ReadUvarint(r) // ok to continue in presence of error
    	x := int64(ux >> 1)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 08 19:04:28 UTC 2023
    - 4.8K bytes
    - Viewed (0)
  4. src/vendor/golang.org/x/net/http2/hpack/hpack.go

    	buf := d.buf
    	size, buf, err := readVarInt(5, buf)
    	if err != nil {
    		return err
    	}
    	if size > uint64(d.dynTab.allowedMaxSize) {
    		return DecodingError{errors.New("dynamic table size update too large")}
    	}
    	d.dynTab.setMaxSize(uint32(size))
    	d.buf = buf
    	return nil
    }
    
    var errVarintOverflow = DecodingError{errors.New("varint integer overflow")}
    
    // readVarInt reads an unsigned variable length integer off the
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Feb 14 18:30:34 UTC 2023
    - 14.7K bytes
    - Viewed (0)
  5. src/cmd/internal/objfile/goobj.go

    	uvdelta := readvarint(p)
    	if uvdelta == 0 && !first {
    		return false
    	}
    	if uvdelta&1 != 0 {
    		uvdelta = ^(uvdelta >> 1)
    	} else {
    		uvdelta >>= 1
    	}
    	vdelta := int32(uvdelta)
    	pcdelta := readvarint(p) * uint32(arch.MinLC)
    	*pc += uint64(pcdelta)
    	*val += vdelta
    	return true
    }
    
    // readvarint reads, removes, and returns a varint from *p.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Aug 15 15:39:57 UTC 2023
    - 7.8K bytes
    - Viewed (0)
  6. src/cmd/internal/gcprog/gcprog.go

    		}
    		nbit := int64(x &^ 0x80)
    		if nbit == 0 {
    			nbit, p = readvarint(p)
    		}
    		var count int64
    		count, p = readvarint(p)
    		n += nbit * count
    	}
    	if len(p) > 0 {
    		println("gcprog: found end instruction after", n, "ptrs, with", len(p), "bytes remaining")
    		panic("gcprog: extra data at end of program")
    	}
    	return n
    }
    
    // readvarint reads a varint from p, returning the value and the remainder of p.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 11 16:34:30 UTC 2022
    - 7.4K bytes
    - Viewed (0)
  7. src/internal/abi/type.go

    func (n Name) Name() string {
    	if n.Bytes == nil {
    		return ""
    	}
    	i, l := n.ReadVarint(1)
    	return unsafe.String(n.DataChecked(1+i, "non-empty string"), l)
    }
    
    // Tag returns the tag string for n, or empty if there is none.
    func (n Name) Tag() string {
    	if !n.HasTag() {
    		return ""
    	}
    	i, l := n.ReadVarint(1)
    	i2, l2 := n.ReadVarint(1 + i + l)
    	return unsafe.String(n.DataChecked(1+i+l+i2, "non-empty string"), l2)
    }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Apr 17 21:09:59 UTC 2024
    - 21.8K bytes
    - Viewed (0)
  8. src/debug/gosym/pclntab.go

    		return funcData{}
    	}
    	idx := sort.Search(int(t.nfunctab), func(i int) bool {
    		return ft.pc(i) > pc
    	})
    	idx--
    	return t.funcData(uint32(idx))
    }
    
    // readvarint reads, removes, and returns a varint from *pp.
    func (t *LineTable) readvarint(pp *[]byte) uint32 {
    	var v, shift uint32
    	p := *pp
    	for shift = 0; ; shift += 7 {
    		b := p[0]
    		p = p[1:]
    		v |= (uint32(b) & 0x7F) << shift
    		if b&0x80 == 0 {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jan 25 19:43:24 UTC 2024
    - 18.8K bytes
    - Viewed (0)
  9. src/go/internal/gcimporter/iimport.go

    	return r.uint64() != 0
    }
    
    func (r *importReader) int64() int64 {
    	n, err := binary.ReadVarint(&r.declReader)
    	if err != nil {
    		errorf("readVarint: %v", err)
    	}
    	return n
    }
    
    func (r *importReader) uint64() uint64 {
    	n, err := binary.ReadUvarint(&r.declReader)
    	if err != nil {
    		errorf("readUvarint: %v", err)
    	}
    	return n
    }
    
    func (r *importReader) byte() byte {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 19.2K bytes
    - Viewed (0)
  10. src/runtime/symtab.go

    	uvdelta := uint32(p[0])
    	if uvdelta == 0 && !first {
    		return nil, false
    	}
    	n := uint32(1)
    	if uvdelta&0x80 != 0 {
    		n, uvdelta = readvarint(p)
    	}
    	*val += int32(-(uvdelta & 1) ^ (uvdelta >> 1))
    	p = p[n:]
    
    	pcdelta := uint32(p[0])
    	n = 1
    	if pcdelta&0x80 != 0 {
    		n, pcdelta = readvarint(p)
    	}
    	p = p[n:]
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 17:58:53 UTC 2024
    - 40K bytes
    - Viewed (0)
Back to top