DataBlockFixture creates data that is independent from its size

This commit is contained in:
Sebastian Messmer 2015-03-04 02:34:54 +01:00
parent 0e91d06a6f
commit 3b06dec1f2

View File

@ -20,11 +20,13 @@ void DataBlockFixture::fillFileWithRandomData(long long int IV) {
val += 1442695040888963407;
reinterpret_cast<long long int*>(_fileData)[i] = val;
}
//Fill remaining bytes
for(size_t i=(_size/sizeof(long long int))*sizeof(long long int); i<_size; ++i) {
uint64_t alreadyWritten = (_size/sizeof(long long int))*sizeof(long long int);
val *= 6364136223846793005L;
val += 1442695040888963407;
reinterpret_cast<char*>(_fileData)[i] = val;
char *remainingBytes = reinterpret_cast<char*>(&val);
//Fill remaining bytes
for(size_t i=0; i<_size-alreadyWritten; ++i) {
reinterpret_cast<char*>(_fileData)[alreadyWritten + i] = remainingBytes[i];
}
}