2020-02-15 22:09:55 +01:00
|
|
|
/* Reflow Oven Controller
|
|
|
|
*
|
|
|
|
* Copyright (C) 2020 Mario Hüttel <mario.huettel@gmx.net>
|
|
|
|
*
|
|
|
|
* This file is part of the Reflow Oven Controller Project.
|
|
|
|
*
|
|
|
|
* The reflow oven controller is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* GDSII-Converter is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with the reflow oven controller project.
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2020-02-10 22:38:24 +01:00
|
|
|
#ifndef __HELPER_MACROS_H__
|
|
|
|
#define __HELPER_MACROS_H__
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
|
|
|
#define xstr(x) str(x)
|
|
|
|
#define str(x) #x
|
|
|
|
|
|
|
|
#define CONCATX(x,y) CONCAT(x,y)
|
|
|
|
#define CONCAT(x,y) x##y
|
|
|
|
|
|
|
|
#define COUNT_OF(x) ((sizeof(x)/sizeof(0[x])) / ((size_t)(!(sizeof(x) % sizeof(0[x])))))
|
2020-09-06 21:05:00 +02:00
|
|
|
#define wordsize_of(x) ((sizeof(x) / 4U) / ((sizeof(x) % 4U) ? 0U : 1U))
|
2020-02-10 22:38:24 +01:00
|
|
|
|
2020-02-15 17:53:15 +01:00
|
|
|
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
|
|
|
|
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
|
|
|
|
|
2020-02-16 18:17:10 +01:00
|
|
|
#define ABS(a) ((a) < 0 ? (-1*(a)) : (a))
|
|
|
|
|
2020-07-09 22:31:42 +02:00
|
|
|
#define is_power_of_two(num) ((num) && !((num) & ((num) - 1)))
|
|
|
|
|
2020-08-18 19:57:13 +02:00
|
|
|
#define IN_SECTION(sec) __attribute__((section(#sec)))
|
|
|
|
|
2020-02-10 22:38:24 +01:00
|
|
|
#endif /* __HELPER_MACROS_H__ */
|