cores: replace max, min, round macros with imports from std (#1783)

fixes #1734
This commit is contained in:
Junxiao Shi 2018-09-17 15:33:01 -04:00 committed by Me No Dev
parent f9f995b283
commit 1e4bf14a3e
4 changed files with 12 additions and 17 deletions

View File

@ -75,7 +75,6 @@
#define abs(x) ((x)>0?(x):-(x)) #define abs(x) ((x)>0?(x):-(x))
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
#define radians(deg) ((deg)*DEG_TO_RAD) #define radians(deg) ((deg)*DEG_TO_RAD)
#define degrees(rad) ((rad)*RAD_TO_DEG) #define degrees(rad) ((rad)*RAD_TO_DEG)
#define sq(x) ((x)*(x)) #define sq(x) ((x)*(x))
@ -146,6 +145,9 @@ void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
#ifdef __cplusplus #ifdef __cplusplus
} }
#include <algorithm>
#include <cmath>
#include "WCharacter.h" #include "WCharacter.h"
#include "WString.h" #include "WString.h"
#include "Stream.h" #include "Stream.h"
@ -158,6 +160,12 @@ void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
#include "HardwareSerial.h" #include "HardwareSerial.h"
#include "Esp.h" #include "Esp.h"
using std::isinf;
using std::isnan;
using std::max;
using std::min;
using ::round;
uint16_t makeWord(uint16_t w); uint16_t makeWord(uint16_t w);
uint16_t makeWord(byte h, byte l); uint16_t makeWord(byte h, byte l);
@ -176,12 +184,6 @@ extern "C" void configTzTime(const char* tz,
long random(long); long random(long);
#endif /* __cplusplus */ #endif /* __cplusplus */
#ifndef _GLIBCXX_VECTOR
// arduino is not compatible with std::vector
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#endif
#define _min(a,b) ((a)<(b)?(a):(b)) #define _min(a,b) ((a)<(b)?(a):(b))
#define _max(a,b) ((a)>(b)?(a):(b)) #define _max(a,b) ((a)>(b)?(a):(b))

View File

@ -23,8 +23,6 @@
#include "Arduino.h" #include "Arduino.h"
#include "Client.h" #include "Client.h"
#undef min
#undef max
#include <memory> #include <memory>
class WiFiClientSocketHandle; class WiFiClientSocketHandle;

View File

@ -46,9 +46,6 @@ extern "C" {
} //extern "C" } //extern "C"
#include "esp32-hal-log.h" #include "esp32-hal-log.h"
#undef min
#undef max
#include <vector> #include <vector>
#include "sdkconfig.h" #include "sdkconfig.h"

View File

@ -27,8 +27,6 @@
#define WIFICLIENTMULTI_H_ #define WIFICLIENTMULTI_H_
#include "WiFi.h" #include "WiFi.h"
#undef min
#undef max
#include <vector> #include <vector>
typedef struct { typedef struct {