diff options
author | Chih-Hung Hsieh <chh@google.com> | 2014-12-11 13:06:46 -0800 |
---|---|---|
committer | Chih-Hung Hsieh <chh@google.com> | 2014-12-11 15:43:04 -0800 |
commit | 650254065e7c6b5abab5e3d154f720753fe1e1cf (patch) | |
tree | 0fe73082f6e245eed99adffa2ba03e160f901675 /services/audioflinger | |
parent | a04c05ab9c0cdca30952a687f9f5bd909c28b86a (diff) | |
download | frameworks_av-650254065e7c6b5abab5e3d154f720753fe1e1cf.zip frameworks_av-650254065e7c6b5abab5e3d154f720753fe1e1cf.tar.gz frameworks_av-650254065e7c6b5abab5e3d154f720753fe1e1cf.tar.bz2 |
Trigger error only when a template is instantiated.
Clang compiler will check defintions and trigger undefined template
error of 'android::CompileTimeAssert<false>' even when MixMul is not
instantiated. Avoid such parse time error but trigger link error when the
generic MixMul template is used.
Change-Id: I84ef60a69fbfbeefc93b5654e4bdd54f9d530867
Diffstat (limited to 'services/audioflinger')
-rw-r--r-- | services/audioflinger/AudioMixerOps.h | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/services/audioflinger/AudioMixerOps.h b/services/audioflinger/AudioMixerOps.h index f7376a8..2678857 100644 --- a/services/audioflinger/AudioMixerOps.h +++ b/services/audioflinger/AudioMixerOps.h @@ -52,15 +52,12 @@ struct is_same<T, T> // partial specialization * * For high precision audio, only the <TO, TI, TV> = <float, float, float> * needs to be accelerated. This is perhaps the easiest form to do quickly as well. + * + * A generic version is NOT defined to catch any mistake of using it. */ template <typename TO, typename TI, typename TV> -inline TO MixMul(TI value, TV volume) { - COMPILE_TIME_ASSERT_FUNCTION_SCOPE(false); - // should not be here :-). - // To avoid mistakes, this template is always specialized. - return value * volume; -} +TO MixMul(TI value, TV volume); template <> inline int32_t MixMul<int32_t, int16_t, int16_t>(int16_t value, int16_t volume) { |