Skip to content

Commit

Permalink
Fix u16 little endian encoding (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mallets authored Oct 12, 2023
1 parent eb657de commit 718d4c5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/protocol/codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ int8_t _z_uint8_decode(uint8_t *u8, _z_zbuf_t *zbf) {
int8_t _z_uint16_encode(_z_wbuf_t *wbf, uint16_t u16) {
int8_t ret = _Z_RES_OK;

ret |= _z_wbuf_write(wbf, ((u16 >> 8) & 0xFF));
ret |= _z_wbuf_write(wbf, (u16 & 0xFF));
ret |= _z_wbuf_write(wbf, ((u16 >> 8) & 0xFF));

return ret;
}
Expand All @@ -163,9 +163,9 @@ int8_t _z_uint16_decode(uint16_t *u16, _z_zbuf_t *zbf) {

uint8_t u8;
ret |= _z_uint8_decode(&u8, zbf);
*u16 |= u8 << 8;
ret |= _z_uint8_decode(&u8, zbf);
*u16 |= u8;
ret |= _z_uint8_decode(&u8, zbf);
*u16 |= u8 << 8;

return ret;
}
Expand Down
6 changes: 3 additions & 3 deletions zenohpico.pc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ prefix=/usr/local
Name: zenohpico
Description:
URL:
Version: 0.10.20230920dev
Cflags: -I${prefix}/
Libs: -L${prefix}/ -lzenohpico
Version: 0.11.20231012dev
Cflags: -I${prefix}/include
Libs: -L${prefix}/lib -lzenohpico

0 comments on commit 718d4c5

Please sign in to comment.