From 3d226e63b07b99a7ff00ea1da0ae6338b01ef5c9 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 4 Mar 2018 15:24:52 +0100 Subject: logic/pipeline: use `likely' equiv for MSVC --- logic/pipeline.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'logic') diff --git a/logic/pipeline.cpp b/logic/pipeline.cpp index 05719351..0d9c2021 100644 --- a/logic/pipeline.cpp +++ b/logic/pipeline.cpp @@ -236,12 +236,15 @@ bool maybe_nan(const char* text, const char* fun, int line, const xs&... vals) return false; } - -#define nan_check(...) \ - do \ - { \ - if (maybe_nan(#__VA_ARGS__, OTR_FUNNAME, __LINE__, __VA_ARGS__)) \ - goto error; \ +// for MSVC `else' is like `unlikely' for GNU + +#define nan_check(...) \ + do \ + { \ + if (likely(!maybe_nan(#__VA_ARGS__, OTR_FUNNAME, __LINE__, __VA_ARGS__))) \ + (void)0; \ + else \ + goto error; \ } while (false) bool pipeline::maybe_enable_center_on_tracking_started() -- cgit v1.2.3