Skip to content

Commit

Permalink
Merge pull request #4 from cracoz/master
Browse files Browse the repository at this point in the history
Fix incorrect processing of negative latitude and longitude
  • Loading branch information
night-codes authored Jun 26, 2018
2 parents e1e8212 + cbacc4c commit 831ec79
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ func readUint16L(bs []byte, offset int) uint16 {
return uint16(bs[offset+1])<<8 + uint16(bs[offset])
}
func readN32L(bs []byte, offset int, coma int) float32 {
return float32(binary.LittleEndian.Uint32(bs[offset:offset+4])) / float32(math.Pow10(coma))
return float32(int32(binary.LittleEndian.Uint32(bs[offset:offset+4]))) / float32(math.Pow10(coma))
}
func readN16L(bs []byte, offset int, coma int) float32 {
return float32(binary.LittleEndian.Uint16(bs[offset:offset+2])) / float32(math.Pow10(coma))
return float32(int16(binary.LittleEndian.Uint16(bs[offset:offset+2]))) / float32(math.Pow10(coma))
}
func readString(bs []byte, offset int) string { // faster than `binary.BigEndian.Uint32`
i := offset
Expand Down

0 comments on commit 831ec79

Please sign in to comment.