Skip to content

Commit

Permalink
6lowpan: udp use subtraction on both conditions
Browse files Browse the repository at this point in the history
Cleanup code to handle both calculation in the same way.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
  • Loading branch information
Alexander Aring authored and Marcel Holtmann committed Dec 17, 2013
1 parent 1672a36 commit 45939d2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/ieee802154/6lowpan_iphc.c
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ static void compress_udp_header(u8 **hc06_ptr, struct sk_buff *skb)
lowpan_push_hc_data(hc06_ptr, &tmp, sizeof(tmp));
tmp = /* subtraction is faster */
(u8)((ntohs(uh->dest) - LOWPAN_NHC_UDP_4BIT_PORT) +
((ntohs(uh->source) & LOWPAN_NHC_UDP_4BIT_PORT) << 4));
((ntohs(uh->source) - LOWPAN_NHC_UDP_4BIT_PORT) << 4));
lowpan_push_hc_data(hc06_ptr, &tmp, sizeof(tmp));
} else if ((ntohs(uh->dest) & LOWPAN_NHC_UDP_8BIT_MASK) ==
LOWPAN_NHC_UDP_8BIT_PORT) {
Expand Down

0 comments on commit 45939d2

Please sign in to comment.