stream/mts/psi/psi.go: simplified HasDescriptor func

This commit is contained in:
saxon 2019-01-29 11:30:37 +10:30
parent dce113d1e4
commit 3a14b64480
1 changed files with 2 additions and 4 deletions

View File

@ -261,12 +261,10 @@ func (p *PSIBytes) HasDescriptor(tag int) Descriptor {
if descs == nil { if descs == nil {
return nil return nil
} }
for i := 0; i < len(descs); { for i := 0; i < len(descs); i += 2 + int(descs[i+1]) {
t := int(descs[i]) if int(descs[i]) == tag {
if t == tag {
return descs[i : i+2+int(descs[i+1])] return descs[i : i+2+int(descs[i+1])]
} }
i += 2 + int(descs[i+1])
} }
return nil return nil
} }