Although 'true' expands to 1, it feels more natural using '0x1' (or '1') when performing masking or bit shifting operations. --- mesh/crypto.c | 6 +++--- mesh/net.c | 4 ++-- mesh/net.h | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mesh/crypto.c b/mesh/crypto.c index a9d670485da5..31001d283a04 100644 --- a/mesh/crypto.c +++ b/mesh/crypto.c @@ -640,7 +640,7 @@ bool mesh_crypto_packet_parse(const uint8_t *packet, uint8_t packet_len, hdr = l_get_be32(packet + 9); - is_segmented = !!((hdr >> SEG_HDR_SHIFT) & true); + is_segmented = !!((hdr >> SEG_HDR_SHIFT) & 0x1); if (segmented) *segmented = is_segmented; @@ -655,7 +655,7 @@ bool mesh_crypto_packet_parse(const uint8_t *packet, uint8_t packet_len, if (this_dst && this_opcode == NET_OP_SEG_ACKNOWLEDGE) { if (relay) - *relay = !!((hdr >> RELAY_HDR_SHIFT) & true); + *relay = !!((hdr >> RELAY_HDR_SHIFT) & 0x1); if (seqZero) *seqZero = (hdr >> SEQ_ZERO_HDR_SHIFT) & @@ -682,7 +682,7 @@ bool mesh_crypto_packet_parse(const uint8_t *packet, uint8_t packet_len, if (is_segmented) { if (szmic) - *szmic = !!((hdr >> SZMIC_HDR_SHIFT) & true); + *szmic = !!((hdr >> SZMIC_HDR_SHIFT) & 0x1); if (seqZero) *seqZero = (hdr >> SEQ_ZERO_HDR_SHIFT) & diff --git a/mesh/net.c b/mesh/net.c index e8e3e271cf59..895b79e60db2 100644 --- a/mesh/net.c +++ b/mesh/net.c @@ -3184,9 +3184,9 @@ void mesh_net_send_seg(struct mesh_net *net, uint32_t net_key_id, { uint8_t packet[30]; uint8_t packet_len; - bool segmented = !!((hdr >> SEG_HDR_SHIFT) & true); + bool segmented = !!((hdr >> SEG_HDR_SHIFT) & 0x1); uint8_t key_aid = (hdr >> KEY_HDR_SHIFT) & KEY_ID_MASK; - bool szmic = !!((hdr >> SZMIC_HDR_SHIFT) & true); + bool szmic = !!((hdr >> SZMIC_HDR_SHIFT) & 0x1); uint16_t seqZero = (hdr >> SEQ_ZERO_HDR_SHIFT) & SEQ_ZERO_MASK; uint8_t segO = (hdr >> SEGO_HDR_SHIFT) & SEG_MASK; uint8_t segN = (hdr >> SEGN_HDR_SHIFT) & SEG_MASK; diff --git a/mesh/net.h b/mesh/net.h index 62b8f5896089..5200beb2fada 100644 --- a/mesh/net.h +++ b/mesh/net.h @@ -65,9 +65,9 @@ struct mesh_node; /* Mask of Hdr bits which must be constant over entire incoming SAR message */ /* (SEG || AKF || AID || SZMIC || SeqZero || SegN) */ -#define HDR_KEY_MASK ((true << SEG_HDR_SHIFT) | \ +#define HDR_KEY_MASK ((0x1 << SEG_HDR_SHIFT) | \ (KEY_ID_MASK << KEY_HDR_SHIFT) | \ - (true << SZMIC_HDR_SHIFT) | \ + (0x1 << SZMIC_HDR_SHIFT) | \ (SEQ_ZERO_MASK << SEQ_ZERO_HDR_SHIFT) | \ (SEG_MASK << SEGN_HDR_SHIFT)) -- 2.43.0