Commit cd5cae17 authored by Anjo Vahldiek's avatar Anjo Vahldiek
Browse files

add unsigned long marshall/unmarshall

parent 34dcdd3f
......@@ -117,6 +117,7 @@ marshall& operator<<(marshall &, char);
marshall& operator<<(marshall &, unsigned short);
marshall& operator<<(marshall &, short);
marshall& operator<<(marshall &, unsigned long long);
marshall& operator<<(marshall &, unsigned long);
marshall& operator<<(marshall &, const std::string &);
class unmarshall {
......@@ -182,6 +183,7 @@ unmarshall& operator>>(unmarshall &, short &);
unmarshall& operator>>(unmarshall &, unsigned int &);
unmarshall& operator>>(unmarshall &, int &);
unmarshall& operator>>(unmarshall &, unsigned long long &);
unmarshall& operator>>(unmarshall &, unsigned long &);
unmarshall& operator>>(unmarshall &, std::string &);
template <class C> marshall &
......
......@@ -687,6 +687,15 @@ operator<<(marshall &m, unsigned long long x)
return m;
}
marshall &
operator<<(marshall &m, unsigned long x)
{
if(sizeof(unsigned long) == sizeof(unsigned int))
return m << (unsigned int)x;
if(sizeof(unsigned long) == sizeof(unsigned long long))
return m << (unsigned long long) x;
}
void
marshall::pack(int x)
{
......@@ -798,6 +807,15 @@ operator>>(unmarshall &u, unsigned long long &x)
return u;
}
unmarshall &
operator>>(unmarshall &u, unsigned long &x)
{
if(sizeof(unsigned long) == sizeof(unsigned int))
return u >> (unsigned int &) x;
if(sizeof(unsigned long) == sizeof(unsigned long long))
return u >> (unsigned long long &) x;
}
unmarshall &
operator>>(unmarshall &u, std::string &s)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment