Make sure not to break compilation if we don't have any atomics.

This commit is contained in:
Pavel Krajcevski 2013-10-14 20:58:11 -04:00
parent 0ecd678a58
commit c8101b46f7

View file

@ -186,6 +186,7 @@ static double CompressImageInSerial(
return cmpTime;
}
#ifdef HAS_ATOMICS
class AtomicThreadUnit : public TCCallable {
CompressionJobList &m_CompressionJobList;
TCBarrier *m_Barrier;
@ -269,6 +270,16 @@ static double CompressImageWithAtomics(
double cmpTimeTotal = sw.TimeInMilliseconds();
return cmpTimeTotal / double(settings.iNumCompressions);
}
#else // HAS_ATOMICS
static double CompressImageWithAtomics(
const unsigned char *imgData,
const unsigned int width, const unsigned int height,
const SCompressionSettings &settings,
unsigned char *outBuf
) {
fprintf(stderr, "Compiler does not support atomic operations!");
}
#endif
static double CompressThreadGroup(ThreadGroup &tgrp, const SCompressionSettings &settings) {
if(!(tgrp.PrepareThreads())) {
@ -419,6 +430,13 @@ bool CompressImageData(
}
#endif
#ifndef HAS_ATOMICS
if(settings.bUseAtomics) {
ReportError("Compiler's atomic operations are not supported!\n");
return false;
}
#endif
if(dataSz <= 0) {
ReportError("No data sent to compress!");
return false;