10 #ifndef _STRUS_BASE_HTON_HPP_INCLUDED 
   11 #define _STRUS_BASE_HTON_HPP_INCLUDED 
   13 #include <arpa/inet.h> 
   18 template <
typename Scalar>
 
   21         typedef void net_value_type;
 
   30         static uint8_t 
hton( 
const uint8_t& value)      {
return value;}
 
   31         static uint8_t 
ntoh( 
const uint8_t& value)      {
return value;}
 
   40         static int8_t 
hton( 
const int8_t& value)        {
return value;}
 
   41         static int8_t 
ntoh( 
const int8_t& value)        {
return value;}
 
   50         static uint16_t 
hton( 
const uint16_t& value)    {
return htons(value);}
 
   51         static uint16_t 
ntoh( 
const uint16_t& value)    {
return ntohs(value);}
 
   60         static int16_t 
hton( 
const int16_t& value)      {
return htons(value);}
 
   61         static int16_t 
ntoh( 
const int16_t& value)      {
return ntohs(value);}
 
   70         static uint32_t 
hton( 
const uint32_t& value)    {
return htonl(value);}
 
   71         static uint32_t 
ntoh( 
const uint32_t& value)    {
return ntohl(value);}
 
   80         static int32_t 
hton( 
const int32_t& value)      {
return htonl(value);}
 
   81         static int32_t 
ntoh( 
const int32_t& value)      {
return ntohl(value);}
 
   90         static uint64_t 
hton( 
const uint64_t& value)
 
   97                 val.p[0] = htonl( value >> 32);
 
   98                 val.p[1] = htonl( value & 0xffFFffFF);
 
  101         static uint64_t 
ntoh( 
const uint64_t& value)
 
  109                 val.p[0] = ntohl( val.p[0]);
 
  110                 val.p[1] = ntohl( val.p[1]);
 
  111                 uint64_t rt = val.p[0];
 
  124         static int64_t 
hton( 
const int64_t& value)
 
  128         static int64_t 
ntoh( 
const int64_t& value)
 
int64_t net_value_type
Definition: hton.hpp:122
static int16_t ntoh(const int16_t &value)
Definition: hton.hpp:61
static int8_t ntoh(const int8_t &value)
Definition: hton.hpp:41
static uint16_t hton(const uint16_t &value)
Definition: hton.hpp:50
static int64_t hton(const int64_t &value)
Definition: hton.hpp:124
uint16_t net_value_type
Definition: hton.hpp:48
static uint32_t hton(const uint32_t &value)
Definition: hton.hpp:70
static net_value_type hton(const float &value)
Definition: hton.hpp:143
int8_t net_value_type
Definition: hton.hpp:38
static int8_t hton(const int8_t &value)
Definition: hton.hpp:40
float_net_t net_value_type
Definition: hton.hpp:141
int32_t net_value_type
Definition: hton.hpp:78
static int64_t ntoh(const int64_t &value)
Definition: hton.hpp:128
static float ntoh(const net_value_type &value)
Definition: hton.hpp:153
uint64_t double_net_t
Definition: hton.hpp:135
static int16_t hton(const int16_t &value)
Definition: hton.hpp:60
uint8_t net_value_type
Definition: hton.hpp:28
static uint32_t ntoh(const uint32_t &value)
Definition: hton.hpp:71
int16_t net_value_type
Definition: hton.hpp:58
uint32_t float_net_t
Definition: hton.hpp:134
uint64_t net_value_type
Definition: hton.hpp:88
double_net_t net_value_type
Definition: hton.hpp:169
static int32_t hton(const int32_t &value)
Definition: hton.hpp:80
static int32_t ntoh(const int32_t &value)
Definition: hton.hpp:81
static net_value_type hton(const double &value)
Definition: hton.hpp:171
static uint8_t ntoh(const uint8_t &value)
Definition: hton.hpp:31
static uint64_t ntoh(const uint64_t &value)
Definition: hton.hpp:101
static uint16_t ntoh(const uint16_t &value)
Definition: hton.hpp:51
static uint8_t hton(const uint8_t &value)
Definition: hton.hpp:30
static uint64_t hton(const uint64_t &value)
Definition: hton.hpp:90
static double ntoh(const net_value_type &value)
Definition: hton.hpp:181
uint32_t net_value_type
Definition: hton.hpp:68