DataBlockFixture create data that is independent from its size

This commit is contained in:
Sebastian Messmer 2015-03-04 02:59:46 +01:00
parent dc32db6a34
commit 02ae3615fd

View File

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