MCPcopy Create free account
hub / github.com/TASEmulators/fceux / AdvanceByteStream

Function AdvanceByteStream

src/lua-engine.cpp:832–844  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

830// read a value from the byte stream and advance the stream by its size
831template<typename T>
832T AdvanceByteStream(const unsigned char*& data, unsigned int& remaining)
833{
834#ifdef IS_LITTLE_ENDIAN
835 T rv = *(T*)data;
836 data += sizeof(T);
837#else
838 T rv; unsigned char* rvptr = (unsigned char*)&rv;
839 for(int i = sizeof(T)-1; i>=0; i--)
840 rvptr[i] = *data++;
841#endif
842 remaining -= sizeof(T);
843 return rv;
844}
845// advance the byte stream by a certain size without reading a value
846void AdvanceByteStream(const unsigned char*& data, unsigned int& remaining, int amount)
847{

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected