mirror of https://github.com/ARMmbed/mbed-os.git
moved initialization into constructor for compatibility with c++03
parent
250ce08712
commit
cad87d11d4
|
@ -22,6 +22,7 @@
|
||||||
template <class T, int Size>
|
template <class T, int Size>
|
||||||
class CircBuffer {
|
class CircBuffer {
|
||||||
public:
|
public:
|
||||||
|
CircBuffer():write(0), read(0){}
|
||||||
bool isFull() {
|
bool isFull() {
|
||||||
return ((write + 1) % size == read);
|
return ((write + 1) % size == read);
|
||||||
};
|
};
|
||||||
|
@ -53,9 +54,9 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
volatile uint16_t write{0}; //in case older compilers are targeted this should be done in a constructor
|
volatile uint16_t write;
|
||||||
volatile uint16_t read{0};
|
volatile uint16_t read;
|
||||||
static constexpr int size{Size+1};
|
static const int size = Size+1;
|
||||||
T buf[Size];
|
T buf[Size];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue