diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2018-12-12 15:11:15 +0100 | 
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-12-12 15:34:28 +0100 | 
| commit | f6443f3d661b23f68b54db278573af15a7e08d0b (patch) | |
| tree | fe5d38da35b1d3ec4099d797f3549b9e4d1a3bfc /logic | |
| parent | 75056045f8cd11801a4ab47700b80cc034c8e1a4 (diff) | |
logic/pipeline: fix nan check
It assumed that all values were of the same type when packing into an
initializer list.
Diffstat (limited to 'logic')
| -rw-r--r-- | logic/pipeline.cpp | 19 | 
1 files changed, 7 insertions, 12 deletions
| diff --git a/logic/pipeline.cpp b/logic/pipeline.cpp index 64adf9c8..a2aaa9f3 100644 --- a/logic/pipeline.cpp +++ b/logic/pipeline.cpp @@ -218,7 +218,7 @@ bool is_nan(const dmat<u,w>& r)      return false;  } -static cc_forceinline +static cc_noinline  void emit_nan_check_msg(const char* text, const char* fun, int line)  {      eval_once( @@ -233,26 +233,21 @@ template<typename... xs>  static cc_noinline  bool maybe_nan(const char* text, const char* fun, int line, const xs&... vals)  { -    for (const auto& x : { vals... }) -        if (is_nan(x)) -        { -            emit_nan_check_msg(text, fun, line); -            return true; -        } -    return false; +    bool ret = (is_nan(vals) || ... || true); + +    if (ret) +        emit_nan_check_msg(text, fun, line); + +    return true;  }  #define nan_check(...)                                                                  \      do                                                                                  \      {                                                                                   \          if (likely(!maybe_nan(#__VA_ARGS__, cc_function_name, __LINE__, __VA_ARGS__)))  \ -        {                                                                               \              (void)0;                                                                    \ -        }                                                                               \          else                                                                            \ -        {                                                                               \              goto error;                                                                 \ -        }                                                                               \      }                                                                                   \      while (false) | 
