diff --git a/panda/src/express/hashVal.cxx b/panda/src/express/hashVal.cxx index 2ee4ee6bd9..ab59b64493 100644 --- a/panda/src/express/hashVal.cxx +++ b/panda/src/express/hashVal.cxx @@ -41,7 +41,7 @@ output_hex(ostream &out) const { } //////////////////////////////////////////////////////////////////// -// Function: HashVal::input +// Function: HashVal::input_hex // Access: Published // Description: Inputs the HashVal as a 32-digit hexadecimal number. //////////////////////////////////////////////////////////////////// @@ -77,6 +77,38 @@ input_hex(istream &in) { decode_hex(buffer + 24, _hv[3]); } +//////////////////////////////////////////////////////////////////// +// Function: HashVal::output_binary +// Access: Published +// Description: Outputs the HashVal as a binary stream of bytes in +// order. This is not the same order generated by +// write_stream(). +//////////////////////////////////////////////////////////////////// +void HashVal:: +output_binary(ostream &out) const { + StreamWriter writer(out); + writer.add_be_uint32(_hv[0]); + writer.add_be_uint32(_hv[1]); + writer.add_be_uint32(_hv[2]); + writer.add_be_uint32(_hv[3]); +} + +//////////////////////////////////////////////////////////////////// +// Function: HashVal::input_binary +// Access: Published +// Description: Inputs the HashVal as a binary stream of bytes in +// order. This is not the same order expected by +// read_stream(). +//////////////////////////////////////////////////////////////////// +void HashVal:: +input_binary(istream &in) { + StreamReader reader(in); + _hv[0] = reader.get_be_uint32(); + _hv[1] = reader.get_be_uint32(); + _hv[2] = reader.get_be_uint32(); + _hv[3] = reader.get_be_uint32(); +} + //////////////////////////////////////////////////////////////////// // Function: HashVal::as_dec // Access: Published diff --git a/panda/src/express/hashVal.h b/panda/src/express/hashVal.h index 76d9f06ee2..203a656eb0 100644 --- a/panda/src/express/hashVal.h +++ b/panda/src/express/hashVal.h @@ -50,6 +50,8 @@ PUBLISHED: INLINE void input_dec(istream &in); void output_hex(ostream &out) const; void input_hex(istream &in); + void output_binary(ostream &out) const; + void input_binary(istream &in); INLINE void output(ostream &out) const;