diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-02-15 09:06:13 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-02-15 10:23:11 +0100 |
commit | 0a92bc147f91f3ecacdf66d995f01f9577107a86 (patch) | |
tree | d748f1b081cd37eb2b4a6cd6b5254433ba8b8dab /filter-accela | |
parent | d8327db8025e56500ebb0bef2ab45aa8963a36ca (diff) |
clean up "static" and "constexpr" types
- use `static constexpr inline' to avoid requiring
explicit declarations in object code
- use `const Foo* const' to maybe put into readonly
binary segment (at least for ELF DSOs)
- `constexpr' in function scope has storage, avoid
`static'
- don't use `constexpr' where there's no advantage,
like arrays
We'd like to avoid overhead of atomic initialization
for each function call. No idea how `static constexpr'
requiring storage in the standard plays with atomic
initialization requirement. Hearsay points that
`constexpr' without `static' in block scope behaves
more to our liking. It's all hazy though.
I'm not 100% sure if `static inline constexpr' has any
storage. Hopefully none, like a #define, and stuff
bigger than registers gets coalesced within the same
module, with small stuff being immediates.
Diffstat (limited to 'filter-accela')
-rw-r--r-- | filter-accela/accela-settings.hpp | 4 | ||||
-rw-r--r-- | filter-accela/ftnoir_filter_accela.cpp | 3 |
2 files changed, 2 insertions, 5 deletions
diff --git a/filter-accela/accela-settings.hpp b/filter-accela/accela-settings.hpp index 2fea2f33..63173aa8 100644 --- a/filter-accela/accela-settings.hpp +++ b/filter-accela/accela-settings.hpp @@ -19,7 +19,7 @@ struct settings_accela : opts double x, y; }; - static constexpr gains rot_gains[16] = + static constexpr inline gains const rot_gains[16] = { { 9, 300 }, { 8, 200 }, @@ -30,7 +30,7 @@ struct settings_accela : opts { .5, .4 }, }; - static constexpr gains pos_gains[16] = + static constexpr inline gains const pos_gains[16] = { { 9, 200 }, { 8, 150 }, diff --git a/filter-accela/ftnoir_filter_accela.cpp b/filter-accela/ftnoir_filter_accela.cpp index fc660d2c..23d71ef0 100644 --- a/filter-accela/ftnoir_filter_accela.cpp +++ b/filter-accela/ftnoir_filter_accela.cpp @@ -14,9 +14,6 @@ #include "compat/math-imports.hpp" -constexpr settings_accela::gains settings_accela::rot_gains[16]; -constexpr settings_accela::gains settings_accela::pos_gains[16]; - accela::accela() : first_run(true) { s.make_splines(spline_rot, spline_pos); |