int CoreIOReader::ReadU64(uint64_t *_buffer) { CoreAssert(this != NULL); if (!IsOpen()) return CC_ERR_INVALID_BUFFER; if (!_buffer) return CC_ERR_INVALID_BUFFER; #ifndef __GNUC__ MutexHolder mh(&m_ioMutex); #endif size_t retval; retval = fread(_buffer, sizeof(uint64_t), 1, m_fileInputPointer); switch (m_endianness) { case CC_ENDIAN_LITTLE: *_buffer = CC_SwapLE64(*_buffer); break; case CC_ENDIAN_BIG: *_buffer = CC_SwapBE64(*_buffer); break; case CC_ENDIAN_NATIVE: /* Do nothing */ break; } return retval; }
int CoreIOWriter::WriteU64(cc_uint64_t _data) { CoreAssert(this != NULL); if (!IsOpen()) return 0; #ifndef __GNUC__ MutexHolder mh(&m_ioMutex); #endif switch (m_endianness) { case CC_ENDIAN_LITTLE: _data = CC_SwapBE64(_data); break; case CC_ENDIAN_BIG: _data = CC_SwapLE64(_data); break; case CC_ENDIAN_NATIVE: /* Do nothing */ break; } size_t ret = fwrite(&_data, sizeof(cc_uint64_t), 1, m_fileOutputPointer); return ret; }