From 57c2b466043dfdcfd510192367f0fd853ba0f4c2 Mon Sep 17 00:00:00 2001 From: Michael Walle Date: Tue, 10 Jul 2018 11:55:44 +0200 Subject: [PATCH] msg: inline net2host64() and host2net64() These functions are just wrappers. Make it possible for the compiler to optimize the calls when compiled with optimization. Signed-off-by: Michael Walle --- msg.c | 12 ------------ msg.h | 11 +++++++++-- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/msg.c b/msg.c index d1a657c..d1619d4 100644 --- a/msg.c +++ b/msg.c @@ -22,8 +22,6 @@ #include #include -#include - #include "contain.h" #include "msg.h" #include "print.h" @@ -80,16 +78,6 @@ static void announce_post_recv(struct announce_msg *m) m->stepsRemoved = ntohs(m->stepsRemoved); } -int64_t host2net64(int64_t val) -{ - return __cpu_to_be64(val); -} - -int64_t net2host64(int64_t val) -{ - return __be64_to_cpu(val); -} - static int hdr_post_recv(struct ptp_header *m) { if ((m->ver & VERSION_MASK) != VERSION) diff --git a/msg.h b/msg.h index 03fe1fd..b5a57fe 100644 --- a/msg.h +++ b/msg.h @@ -23,6 +23,7 @@ #include #include #include +#include #include "address.h" #include "ddt.h" @@ -427,11 +428,17 @@ static inline Boolean one_step(struct ptp_message *m) /** * Convert a 64 bit word into network byte order. */ -int64_t host2net64(int64_t val); +static inline int64_t host2net64(int64_t val) +{ + return __cpu_to_be64(val); +} /** * Convert a 64 bit word into host byte order. */ -int64_t net2host64(int64_t val); +static inline int64_t net2host64(int64_t val) +{ + return __be64_to_cpu(val); +} #endif