aboutsummaryrefslogtreecommitdiff
path: root/src/internal/pkgbits/decoder.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/internal/pkgbits/decoder.go')
-rw-r--r--src/internal/pkgbits/decoder.go30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/internal/pkgbits/decoder.go b/src/internal/pkgbits/decoder.go
index bbda6e9285..f9e37b9e1e 100644
--- a/src/internal/pkgbits/decoder.go
+++ b/src/internal/pkgbits/decoder.go
@@ -131,7 +131,7 @@ func (pr *PkgDecoder) Fingerprint() [8]byte {
// AbsIdx returns the absolute index for the given (section, index)
// pair.
-func (pr *PkgDecoder) AbsIdx(k SectionKind, idx RelIndex) int {
+func (pr *PkgDecoder) AbsIdx(k SectionKind, idx RelElemIdx) int {
absIdx := int(idx)
if k > 0 {
absIdx += int(pr.elemEndsEnds[k-1])
@@ -144,7 +144,7 @@ func (pr *PkgDecoder) AbsIdx(k SectionKind, idx RelIndex) int {
// DataIdx returns the raw element bitstream for the given (section,
// index) pair.
-func (pr *PkgDecoder) DataIdx(k SectionKind, idx RelIndex) string {
+func (pr *PkgDecoder) DataIdx(k SectionKind, idx RelElemIdx) string {
absIdx := pr.AbsIdx(k, idx)
var start uint32
@@ -157,13 +157,13 @@ func (pr *PkgDecoder) DataIdx(k SectionKind, idx RelIndex) string {
}
// StringIdx returns the string value for the given string index.
-func (pr *PkgDecoder) StringIdx(idx RelIndex) string {
+func (pr *PkgDecoder) StringIdx(idx RelElemIdx) string {
return pr.DataIdx(SectionString, idx)
}
// NewDecoder returns a Decoder for the given (section, index) pair,
// and decodes the given SyncMarker from the element bitstream.
-func (pr *PkgDecoder) NewDecoder(k SectionKind, idx RelIndex, marker SyncMarker) Decoder {
+func (pr *PkgDecoder) NewDecoder(k SectionKind, idx RelElemIdx, marker SyncMarker) Decoder {
r := pr.NewDecoderRaw(k, idx)
r.Sync(marker)
return r
@@ -173,7 +173,7 @@ func (pr *PkgDecoder) NewDecoder(k SectionKind, idx RelIndex, marker SyncMarker)
// and decodes the given SyncMarker from the element bitstream.
// If possible the Decoder should be RetireDecoder'd when it is no longer
// needed, this will avoid heap allocations.
-func (pr *PkgDecoder) TempDecoder(k SectionKind, idx RelIndex, marker SyncMarker) Decoder {
+func (pr *PkgDecoder) TempDecoder(k SectionKind, idx RelElemIdx, marker SyncMarker) Decoder {
r := pr.TempDecoderRaw(k, idx)
r.Sync(marker)
return r
@@ -187,7 +187,7 @@ func (pr *PkgDecoder) RetireDecoder(d *Decoder) {
// NewDecoderRaw returns a Decoder for the given (section, index) pair.
//
// Most callers should use NewDecoder instead.
-func (pr *PkgDecoder) NewDecoderRaw(k SectionKind, idx RelIndex) Decoder {
+func (pr *PkgDecoder) NewDecoderRaw(k SectionKind, idx RelElemIdx) Decoder {
r := Decoder{
common: pr,
k: k,
@@ -199,13 +199,13 @@ func (pr *PkgDecoder) NewDecoderRaw(k SectionKind, idx RelIndex) Decoder {
r.Relocs = make([]RefTableEntry, r.Len())
for i := range r.Relocs {
r.Sync(SyncReloc)
- r.Relocs[i] = RefTableEntry{SectionKind(r.Len()), RelIndex(r.Len())}
+ r.Relocs[i] = RefTableEntry{SectionKind(r.Len()), RelElemIdx(r.Len())}
}
return r
}
-func (pr *PkgDecoder) TempDecoderRaw(k SectionKind, idx RelIndex) Decoder {
+func (pr *PkgDecoder) TempDecoderRaw(k SectionKind, idx RelElemIdx) Decoder {
r := Decoder{
common: pr,
k: k,
@@ -223,7 +223,7 @@ func (pr *PkgDecoder) TempDecoderRaw(k SectionKind, idx RelIndex) Decoder {
}
for i := range r.Relocs {
r.Sync(SyncReloc)
- r.Relocs[i] = RefTableEntry{SectionKind(r.Len()), RelIndex(r.Len())}
+ r.Relocs[i] = RefTableEntry{SectionKind(r.Len()), RelElemIdx(r.Len())}
}
return r
@@ -238,7 +238,7 @@ type Decoder struct {
Data strings.Reader
k SectionKind
- Idx RelIndex
+ Idx RelElemIdx
}
func (r *Decoder) checkErr(err error) {
@@ -292,7 +292,7 @@ func (r *Decoder) rawVarint() int64 {
return x
}
-func (r *Decoder) rawReloc(k SectionKind, idx int) RelIndex {
+func (r *Decoder) rawReloc(k SectionKind, idx int) RelElemIdx {
e := r.Relocs[idx]
assert(e.Kind == k)
return e.Idx
@@ -401,7 +401,7 @@ func (r *Decoder) Code(mark SyncMarker) int {
// Reloc decodes a relocation of expected section k from the element
// bitstream and returns an index to the referenced element.
-func (r *Decoder) Reloc(k SectionKind) RelIndex {
+func (r *Decoder) Reloc(k SectionKind) RelElemIdx {
r.Sync(SyncUseReloc)
return r.rawReloc(k, r.Len())
}
@@ -478,7 +478,7 @@ func (r *Decoder) bigFloat() *big.Float {
// PeekPkgPath returns the package path for the specified package
// index.
-func (pr *PkgDecoder) PeekPkgPath(idx RelIndex) string {
+func (pr *PkgDecoder) PeekPkgPath(idx RelElemIdx) string {
var path string
{
r := pr.TempDecoder(SectionPkg, idx, SyncPkgDef)
@@ -493,8 +493,8 @@ func (pr *PkgDecoder) PeekPkgPath(idx RelIndex) string {
// PeekObj returns the package path, object name, and CodeObj for the
// specified object index.
-func (pr *PkgDecoder) PeekObj(idx RelIndex) (string, string, CodeObj) {
- var ridx RelIndex
+func (pr *PkgDecoder) PeekObj(idx RelElemIdx) (string, string, CodeObj) {
+ var ridx RelElemIdx
var name string
var rcode int
{