bugfix: high fifo depth more than 32 bit

This commit is contained in:
maliakal_d 2020-01-27 15:21:19 +01:00
parent 2314fdabd1
commit a0208778c1
2 changed files with 5 additions and 5 deletions

View File

@ -45,13 +45,13 @@ void Fifo::CreateFifos(uint32_t fifoItemSize) {
fifoFree = new CircularFifo<char>(fifoDepth);
fifoStream = new CircularFifo<char>(fifoDepth);
//allocate memory
size_t mem_len = fifoItemSize * fifoDepth * sizeof(char);
size_t mem_len = (size_t)fifoItemSize * (size_t)fifoDepth * sizeof(char);
memory = (char*) malloc (mem_len);
if (memory == nullptr){
throw sls::RuntimeError("Could not allocate memory for fifos");
}
memset(memory, 0, mem_len);
FILE_LOG(logDEBUG) << "Memory Allocated " << index << ": " << mem_len << " bytes";
FILE_LOG(logDEBUG) << "Memory Allocated " << index << ": " << (double)mem_len/(1000.00 * 1000.00) << " Mb";
{ //push free addresses into fifoFree fifo
char* buffer = memory;

View File

@ -193,10 +193,10 @@ void Implementation::SetupFifoStructure() {
}
FILE_LOG(logINFO) << "Memory Allocated Per Fifo: "
<< (((generalData->imageSize) +
<< (double)(((generalData->imageSize) +
(generalData->fifoBufferHeaderSize)) *
fifoDepth)
<< " bytes";
fifoDepth) / (1000.00 * 1000.00)
<< " Mb";
FILE_LOG(logINFO) << numThreads << " Fifo structure(s) reconstructed";
}