From: Jiri Vlasak Date: Mon, 24 Jun 2019 10:01:19 +0000 (+0200) Subject: Refactor X-Git-Tag: v0.7.0~6^2~3 X-Git-Url: http://rtime.felk.cvut.cz/gitweb/hubacji1/iamcar.git/commitdiff_plain/c548243a35cbbfd377ed418c3c69add75d95bc37?ds=sidebyside Refactor --- diff --git a/incl/aux.h b/incl/aux.h index 7884242..73fefb8 100644 --- a/incl/aux.h +++ b/incl/aux.h @@ -18,19 +18,27 @@ along with I am car. If not, see . #ifndef AUX_H #define AUX_H -#define EDIST(a, b) ({ __typeof__ (a) _a = (a); \ - __typeof__ (b) _b = (b); \ - pow(pow((_b)->x() - (_a)->x(), 2) + \ - pow((_b)->y() - (_a)->y(), 2), 0.5); }) +#define EDIST(a, b) ({ \ + __typeof__ (a) _a = (a); \ + __typeof__ (b) _b = (b); \ + sqrt( \ + pow((_b)->x() - (_a)->x(), 2) \ + + pow((_b)->y() - (_a)->y(), 2) \ + ); \ +}) // see http://www.cplusplus.com/reference/algorithm/max/ -#define MAX(a, b) ({ __typeof__ (a) _a = (a); \ - __typeof__ (b) _b = (b); \ - (_a < _b) ? _b : _a; }) +#define MAX(a, b) ({ \ + __typeof__ (a) _a = (a); \ + __typeof__ (b) _b = (b); \ + (_a < _b) ? _b : _a; \ +}) // see http://www.cplusplus.com/reference/algorithm/min/ -#define MIN(a, b) ({ __typeof__ (a) _a = (a); \ - __typeof__ (b) _b = (b); \ - !(_b < _a) ? _a : _b; }) +#define MIN(a, b) ({ \ + __typeof__ (a) _a = (a); \ + __typeof__ (b) _b = (b); \ + !(_b < _a) ? _a : _b; \ +}) #endif