diff --git a/include/bit_util.h b/include/bit_util.h index 05b777eb..c1924d11 100644 --- a/include/bit_util.h +++ b/include/bit_util.h @@ -14,14 +14,6 @@ #include <stdint.h> -// Helper macros, collides with MSVC's stdlib.h unless NOMINMAX is used -#ifndef MAX -#define MAX(a,b) ((a) > (b) ? (a) : (b)) -#endif -#ifndef MIN -#define MIN(a,b) ((a) < (b) ? (a) : (b)) -#endif - /// Reverse (reflect) the bits in an 32 bit byte. /// /// @param x input byte diff --git a/include/c_util.h b/include/c_util.h new file mode 100644 index 00000000..5845fe6f --- /dev/null +++ b/include/c_util.h @@ -0,0 +1,23 @@ +/** @file + General C language utility macro. + + Copyright (C) 2018 Christian W. Zuckschwerdt <zany@triq.net> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. +*/ + +#ifndef INCLUDE_C_UTIL_H_ +#define INCLUDE_C_UTIL_H_ + +// Helper macros, collides with MSVC's stdlib.h unless NOMINMAX is used +#ifndef MAX +#define MAX(a,b) ((a) > (b) ? (a) : (b)) +#endif +#ifndef MIN +#define MIN(a,b) ((a) < (b) ? (a) : (b)) +#endif + +#endif /* INCLUDE_C_UTIL_H_ */ diff --git a/include/decoder.h b/include/decoder.h index fdfd1fd6..e6d2eee8 100644 --- a/include/decoder.h +++ b/include/decoder.h @@ -12,5 +12,6 @@ #include "data.h" #include "bit_util.h" #include "decoder_util.h" +#include "c_util.h" #endif /* INCLUDE_DECODER_H_ */ diff --git a/src/data_tag.c b/src/data_tag.c index 5399042a..15b6bb45 100644 --- a/src/data_tag.c +++ b/src/data_tag.c @@ -19,7 +19,7 @@ #include "data.h" #include "list.h" #include "optparse.h" -#include "util.h" // for MIN() +#include "c_util.h" // for MIN() #include "fileformat.h" #include "fatal.h" diff --git a/src/pulse_analyzer.c b/src/pulse_analyzer.c index efbbdca4..0609bf0e 100644 --- a/src/pulse_analyzer.c +++ b/src/pulse_analyzer.c @@ -11,7 +11,7 @@ #include "pulse_analyzer.h" #include "pulse_slicer.h" -#include "bit_util.h" // for MIN(), MAX() +#include "c_util.h" // for MIN(), MAX() #include <stdio.h> #include <stdlib.h> #include <string.h> diff --git a/src/pulse_detect.c b/src/pulse_detect.c index e2b0b727..13b94e84 100644 --- a/src/pulse_detect.c +++ b/src/pulse_detect.c @@ -14,7 +14,7 @@ #include "pulse_detect_fsk.h" #include "pulse_data.h" #include "baseband.h" -#include "bit_util.h" // for MIN(), MAX() +#include "c_util.h" // for MIN(), MAX() #include "logger.h" #include "fatal.h" #include <stdio.h> diff --git a/src/pulse_detect_fsk.c b/src/pulse_detect_fsk.c index 895d776e..a65590e8 100644 --- a/src/pulse_detect_fsk.c +++ b/src/pulse_detect_fsk.c @@ -12,7 +12,7 @@ */ #include "pulse_detect_fsk.h" -#include "bit_util.h" // for MIN(), MAX() +#include "c_util.h" // for MIN(), MAX() #include <limits.h> #include <stdio.h> #include <stdlib.h> diff --git a/src/pulse_slicer.c b/src/pulse_slicer.c index 525004d4..b204cd4a 100644 --- a/src/pulse_slicer.c +++ b/src/pulse_slicer.c @@ -14,7 +14,7 @@ #include "pulse_slicer.h" #include "pulse_data.h" #include "bitbuffer.h" -#include "bit_util.h" // for MIN() +#include "c_util.h" // for MIN() #include "logger.h" #include "decoder_util.h" // TODO: this should be refactored #include <stdio.h>