@@ -29,24 +29,29 @@ namespace MR::Adapter {
29
29
namespace {
30
30
// Partial specialisation for boolean value_type in order to avoid compiler
31
31
// warning regarding use of multiplication when assigning to a boolean
32
- template <typename value_type>
33
- typename std::enable_if<std::is_same<value_type, bool >::value, value_type>::type inline normalise (
34
- const default_type sum, const default_type norm) {
32
+ template <typename value_type> //
33
+ typename std::enable_if<std::is_same<value_type, bool >::value, //
34
+ value_type>::type inline //
35
+ normalise (const default_type sum, const default_type norm) { //
35
36
return ((sum * norm) >= 0.5 ) ? true : false ;
36
37
}
37
38
38
39
// Partial specialisation to invoke round-to-nearest when taking an average of integers
39
- template <typename value_type>
40
- typename std::enable_if<!std::is_same<value_type, bool >::value && std::is_integral<value_type>::value,
41
- value_type>::type inline normalise (const default_type sum, const default_type norm) {
40
+ template <typename value_type> //
41
+ typename std::enable_if<!std::is_same<value_type, bool >::value && //
42
+ std::is_integral<value_type>::value, //
43
+ value_type>::type inline //
44
+ normalise (const default_type sum, const default_type norm) { //
42
45
return value_type (std::round (sum * norm));
43
46
}
44
47
45
48
// Standard implementation for floating point (either real or complex)
46
- template <typename value_type, typename summing_type>
47
- typename std::enable_if<!std::is_same<value_type, bool >::value && !std::is_integral<value_type>::value, value_type>::type
48
- inline normalise (const summing_type sum, const default_type norm) {
49
- return value_type (sum * norm);
49
+ template <typename value_type, typename summing_type> //
50
+ typename std::enable_if<!std::is_same<value_type, bool >::value && //
51
+ !std::is_integral<value_type>::value, //
52
+ value_type>::type inline //
53
+ normalise (const summing_type sum, const default_type norm) { //
54
+ return value_type (sum * norm);
50
55
}
51
56
52
57
// If summing complex numbers, use double precision complex;
0 commit comments