aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-09-28 16:40:38 -0700
committerChris Robinson <[email protected]>2019-09-28 16:40:38 -0700
commit7783fa738c678ad88c8f4571f48ad0191767cbf1 (patch)
tree7e2b6180fbac51645799d5fc247483ef1167520e
parent4b746b8d37911600bb64e3cb9efe8c370968df1d (diff)
Make the BSincTables constexpr in an anonymous namespace
-rw-r--r--alc/alu.h1
-rw-r--r--native-tools/bsincgen.c6
2 files changed, 4 insertions, 3 deletions
diff --git a/alc/alu.h b/alc/alu.h
index abe73245..1d530602 100644
--- a/alc/alu.h
+++ b/alc/alu.h
@@ -24,7 +24,6 @@
struct ALbufferlistitem;
struct ALeffectslot;
-struct BSincTable;
enum class DistanceModel;
diff --git a/native-tools/bsincgen.c b/native-tools/bsincgen.c
index b99d482f..83f03191 100644
--- a/native-tools/bsincgen.c
+++ b/native-tools/bsincgen.c
@@ -257,7 +257,7 @@ static void BsiGenerateTables(FILE *output, const char *tabname, const double re
" * width) suffers to reduce the CPU cost. The bandlimiting will cut all sound\n"
" * after downsampling by ~%.2f octaves.\n"
" */\n"
-"alignas(16) static constexpr float %s_tab[%d] = {\n",
+"alignas(16) constexpr float %s_tab[%d] = {\n",
order, (((order%100)/10) == 1) ? "th" :
((order%10) == 1) ? "st" :
((order%10) == 2) ? "nd" :
@@ -286,7 +286,7 @@ static void BsiGenerateTables(FILE *output, const char *tabname, const double re
fprintf(output, "\n");
}
}
- fprintf(output, "};\nconst BSincTable %s = {\n", tabname);
+ fprintf(output, "};\nconstexpr BSincTable %s = {\n", tabname);
/* The scaleBase is calculated from the Kaiser window transition width.
It represents the absolute limit to the filter before it fully cuts
@@ -344,6 +344,7 @@ int main(int argc, char *argv[])
"#pragma once\n\n"
"static_assert(BSINC_SCALE_COUNT == %d, \"Unexpected BSINC_SCALE_COUNT value!\");\n"
"static_assert(BSINC_PHASE_COUNT == %d, \"Unexpected BSINC_PHASE_COUNT value!\");\n\n"
+"namespace {\n\n"
"struct BSincTable {\n"
" const float scaleBase, scaleRange;\n"
" const unsigned int m[BSINC_SCALE_COUNT];\n"
@@ -355,6 +356,7 @@ int main(int argc, char *argv[])
/* An 11th order filter with a -40dB drop at nyquist. */
BsiGenerateTables(output, "bsinc12", 40.0, 11);
+ fprintf(output, "} // namespace\n");
if(output != stdout)
fclose(output);
output = NULL;