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 {
return nil
}
for i := 0; i < len(descs); {
t := int(descs[i])
if t == tag {
for i := 0; i < len(descs); i += 2 + int(descs[i+1]) {
if int(descs[i]) == tag {
return descs[i : i+2+int(descs[i+1])]
}
i += 2 + int(descs[i+1])
}
return nil
}