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 <michael@walle.cc>master
parent
8f484e8312
commit
57c2b46604
12
msg.c
12
msg.c
|
@ -22,8 +22,6 @@
|
|||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
#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)
|
||||
|
|
11
msg.h
11
msg.h
|
@ -23,6 +23,7 @@
|
|||
#include <stdio.h>
|
||||
#include <sys/queue.h>
|
||||
#include <time.h>
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
#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
|
||||
|
|
Loading…
Reference in New Issue