mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-14 01:27:34 -05:00
#1661 Resolves issue with parsing of DMR embedded GPS latitude and longitude values.
This commit is contained in:
@@ -844,13 +844,18 @@ public class BinaryMessage extends BitSet
|
|||||||
*/
|
*/
|
||||||
public int getTwosComplement(int start, int end)
|
public int getTwosComplement(int start, int end)
|
||||||
{
|
{
|
||||||
BinaryMessage sub = getSubMessage(start, end);
|
if(get(start))
|
||||||
boolean negative = sub.get(start);
|
{
|
||||||
sub.flip(0, sub.size());
|
//Negative value - flip and add one
|
||||||
|
BinaryMessage fragment = getSubMessage(start, end);
|
||||||
int value = sub.getInt(0, sub.size()) + 1;
|
fragment.flip(0, fragment.size());
|
||||||
value *= (negative ? -1 : 1);
|
return fragment.getInt(1, fragment.size()) + 1;
|
||||||
return value;
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Positive value - return the contents.
|
||||||
|
return getInt(start + 1, end);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user