kopia lustrzana https://github.com/M17-Project/M17_Implementations
endianness fix in`decode_callsign_bytes()`
rodzic
282f986994
commit
1c6a39d679
|
@ -2,7 +2,7 @@ INC = -I .
|
|||
|
||||
TARGET = libm17.so
|
||||
|
||||
CFLAGS = $(INC) -fPIC -Wall
|
||||
CFLAGS = $(INC) -fPIC -Wall -Wextra
|
||||
LDFLAGS = -shared -lm
|
||||
SRCS = $(wildcard *.c) $(wildcard */*.c)
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
|
|
|
@ -105,7 +105,10 @@ uint16_t add16(const uint16_t a, const uint16_t b)
|
|||
*/
|
||||
uint16_t sub16(const uint16_t a, const uint16_t b)
|
||||
{
|
||||
return a>=b ? a-b : 0x0000U;
|
||||
if(a>=b)
|
||||
return a-b;
|
||||
else
|
||||
return 0x0000U;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,7 +23,7 @@ void decode_callsign_bytes(uint8_t *outp, const uint8_t inp[6])
|
|||
|
||||
//repack the data to a uint64_t
|
||||
for(uint8_t i=0; i<6; i++)
|
||||
encoded|=(uint64_t)inp[5-i]<<(8*i);
|
||||
encoded|=(uint64_t)inp[i]<<(8*i);
|
||||
|
||||
//check if the value is reserved (not a callsign)
|
||||
if(encoded>=262144000000000ULL)
|
||||
|
|
Ładowanie…
Reference in New Issue