mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-01 12:00:53 +00:00
Minor speedup ip_output_if when writing TTL/proto to ip header
This commit is contained in:
parent
67c587f9f7
commit
1c47d15577
@ -553,8 +553,7 @@ err_t ip_output_if_opt(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest
|
||||
LWIP_ASSERT("check that first pbuf can hold struct ip_hdr",
|
||||
(p->len >= sizeof(struct ip_hdr)));
|
||||
|
||||
IPH_TTL_SET(iphdr, ttl);
|
||||
IPH_PROTO_SET(iphdr, proto);
|
||||
IPH_TTL_PROTO_SET(iphdr, ttl, proto);
|
||||
|
||||
ip_addr_set(&(iphdr->dest), dest);
|
||||
|
||||
|
@ -149,6 +149,7 @@ PACK_STRUCT_END
|
||||
#define IPH_LEN_SET(hdr, len) (hdr)->_len = (len)
|
||||
#define IPH_ID_SET(hdr, id) (hdr)->_id = (id)
|
||||
#define IPH_OFFSET_SET(hdr, off) (hdr)->_offset = (off)
|
||||
#define IPH_TTL_PROTO_SET(hdr, ttl, proto) (hdr)->_ttl_proto = (htons((u8_t)(proto) | ((u16_t)(ttl) << 8)))
|
||||
#define IPH_TTL_SET(hdr, ttl) (hdr)->_ttl_proto = (htons(IPH_PROTO(hdr) | ((u16_t)(ttl) << 8)))
|
||||
#define IPH_PROTO_SET(hdr, proto) (hdr)->_ttl_proto = (htons((proto) | (IPH_TTL(hdr) << 8)))
|
||||
#define IPH_CHKSUM_SET(hdr, chksum) (hdr)->_chksum = (chksum)
|
||||
|
Loading…
Reference in New Issue
Block a user