Skip to content

Commit

Permalink
Port to c++03
Browse files Browse the repository at this point in the history
  • Loading branch information
Tak committed Sep 6, 2016
1 parent 8a07f99 commit c542724
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions source/smolv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
#include <cstdio>
#include <cstring>

#if !defined(_MSC_VER) && __cplusplus < 201103L
#define static_assert(x,y)
#endif

#define _SMOLV_ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))

// --------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -1823,7 +1827,10 @@ bool smolv::StatsCalculateSmol(smolv::Stats* stats, const void* smolvData, size_
return true;
}


static bool CompareOpCounters (std::pair<SpvOp,size_t> a, std::pair<SpvOp,size_t> b)
{
return a.second > b.second;
}

void smolv::StatsPrint(const Stats* stats)
{
Expand All @@ -1843,9 +1850,9 @@ void smolv::StatsPrint(const Stats* stats)
sizesSmol[i].first = (SpvOp)i;
sizesSmol[i].second = stats->smolOpSizes[i];
}
std::sort(counts, counts + kKnownOpsCount, [](OpCounter a, OpCounter b) { return a.second > b.second; });
std::sort(sizes, sizes + kKnownOpsCount, [](OpCounter a, OpCounter b) { return a.second > b.second; });
std::sort(sizesSmol, sizesSmol + kKnownOpsCount, [](OpCounter a, OpCounter b) { return a.second > b.second; });
std::sort(counts, counts + kKnownOpsCount, CompareOpCounters);
std::sort(sizes, sizes + kKnownOpsCount, CompareOpCounters);
std::sort(sizesSmol, sizesSmol + kKnownOpsCount, CompareOpCounters);

printf("Stats for %i SPIR-V inputs, total size %i words (%.1fKB):\n", (int)stats->inputCount, (int)stats->totalSize, stats->totalSize * 4.0f / 1024.0f);
printf("Most occuring ops:\n");
Expand Down

0 comments on commit c542724

Please sign in to comment.