| 816 | // push a value's bytes onto the output stack |
| 817 | template<typename T> |
| 818 | void PushBinaryItem(T item, std::vector<unsigned char>& output) |
| 819 | { |
| 820 | unsigned char* buf = (unsigned char*)&item; |
| 821 | #ifdef IS_LITTLE_ENDIAN |
| 822 | for(int i = sizeof(T); i; i--) |
| 823 | output.push_back(*buf++); |
| 824 | #else |
| 825 | int vecsize = output.size(); |
| 826 | for(int i = sizeof(T); i; i--) |
| 827 | output.insert(output.begin() + vecsize, *buf++); |
| 828 | #endif |
| 829 | } |
| 830 | // read a value from the byte stream and advance the stream by its size |
| 831 | template<typename T> |
| 832 | T AdvanceByteStream(const unsigned char*& data, unsigned int& remaining) |
no test coverage detected