From cbacc4ce5145fc503b87688f32d1690c92e3f8d5 Mon Sep 17 00:00:00 2001 From: Bronin Egor Date: Tue, 26 Jun 2018 16:25:21 +0300 Subject: [PATCH] fix incorrect processing of negative latitude and longitude --- utils.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils.go b/utils.go index 02eeb68..b7e8f5e 100644 --- a/utils.go +++ b/utils.go @@ -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