psi: removed conditional in HasTime and HasLocation and just used result of logic operation

This commit is contained in:
saxon 2019-01-08 20:04:45 +10:30
parent d665bece23
commit fc7f5501e0
1 changed files with 2 additions and 8 deletions

View File

@ -44,19 +44,13 @@ func TimeBytes(t uint64) []byte {
// HasTime takes a psi as a byte slice and checks to see if it has a time descriptor // HasTime takes a psi as a byte slice and checks to see if it has a time descriptor
// - if so return nil, otherwise return error // - if so return nil, otherwise return error
func HasTime(p []byte) bool { func HasTime(p []byte) bool {
if p[TimeTagIndx] == TimeDescTag { return p[TimeTagIndx] == TimeDescTag
return true
}
return false
} }
// HasLocation takes a psi as a byte slice and checks to see if it has a location descriptor // HasLocation takes a psi as a byte slice and checks to see if it has a location descriptor
// - if so return nil, otherwise return error // - if so return nil, otherwise return error
func HasLocation(p []byte) bool { func HasLocation(p []byte) bool {
if p[LocationTagIndx] == LocationDescTag { return p[LocationTagIndx] == LocationDescTag
return true
}
return false
} }
// UpdateTime takes the byte slice representation of a psi-pmt as well as a time // UpdateTime takes the byte slice representation of a psi-pmt as well as a time