diff --git a/SH1106Brzo.h b/SH1106Brzo.h
index 56a2bb89d6211bd94fa7cabca89ea17ab062a248..8ef3d5b86100a6018637e13f362bc51b404906e6 100644
--- a/SH1106Brzo.h
+++ b/SH1106Brzo.h
@@ -62,10 +62,10 @@ class SH1106Brzo : public OLEDDisplay {
 
     void display(void) {
     #ifdef OLEDDISPLAY_DOUBLE_BUFFER
-       uint8_t minBoundY = ~0;
+       uint8_t minBoundY = UINT8_MAX;
        uint8_t maxBoundY = 0;
 
-       uint8_t minBoundX = ~0;
+       uint8_t minBoundX = UINT8_MAX;
        uint8_t maxBoundX = 0;
        uint8_t x, y;
 
@@ -88,7 +88,7 @@ class SH1106Brzo : public OLEDDisplay {
        // If the minBoundY wasn't updated
        // we can savely assume that buffer_back[pos] == buffer[pos]
        // holdes true for all values of pos
-       if (minBoundY == ~0) return;
+       if (minBoundY == UINT8_MAX) return;
 
        byte k = 0;
        uint8_t sendBuffer[17];
diff --git a/SH1106Spi.h b/SH1106Spi.h
index 1267c07d8426be8d185d167b7d904a7e01b946ea..cf8f088e45f2a571bada27b83db8c31cf96d60dc 100644
--- a/SH1106Spi.h
+++ b/SH1106Spi.h
@@ -65,10 +65,10 @@ class SH1106Spi : public OLEDDisplay {
 
     void display(void) {
     #ifdef OLEDDISPLAY_DOUBLE_BUFFER
-       uint8_t minBoundY = ~0;
+       uint8_t minBoundY = UINT8_MAX;
        uint8_t maxBoundY = 0;
 
-       uint8_t minBoundX = ~0;
+       uint8_t minBoundX = UINT8_MAX;
        uint8_t maxBoundX = 0;
 
        uint8_t x, y;
@@ -92,7 +92,7 @@ class SH1106Spi : public OLEDDisplay {
        // If the minBoundY wasn't updated
        // we can savely assume that buffer_back[pos] == buffer[pos]
        // holdes true for all values of pos
-       if (minBoundY == ~0) return;
+       if (minBoundY == UINT8_MAX) return;
 
        // Calculate the colum offset
        uint8_t minBoundXp2H = (minBoundX + 2) & 0x0F;
diff --git a/SH1106Wire.h b/SH1106Wire.h
index d2cceb43dea18012188e26489cdedb7b5bca0d63..486ba1ad562f918e855a3ea555a1133d1d65ff1c 100644
--- a/SH1106Wire.h
+++ b/SH1106Wire.h
@@ -65,10 +65,10 @@ class SH1106Wire : public OLEDDisplay {
 
     void display(void) {
       #ifdef OLEDDISPLAY_DOUBLE_BUFFER
-        uint8_t minBoundY = ~0;
+        uint8_t minBoundY = UINT8_MAX;
         uint8_t maxBoundY = 0;
 
-        uint8_t minBoundX = ~0;
+        uint8_t minBoundX = UINT8_MAX;
         uint8_t maxBoundX = 0;
 
         uint8_t x, y;
@@ -92,7 +92,7 @@ class SH1106Wire : public OLEDDisplay {
         // If the minBoundY wasn't updated
         // we can savely assume that buffer_back[pos] == buffer[pos]
         // holdes true for all values of pos
-        if (minBoundY == ~0) return;
+        if (minBoundY == UINT8_MAX) return;
 
         // Calculate the colum offset
         uint8_t minBoundXp2H = (minBoundX + 2) & 0x0F;
diff --git a/SSD1306Brzo.h b/SSD1306Brzo.h
index 9c0093dc0cde6d8b9c245818ba883403aa479a5b..e90b7b36c37a0d5c4e32922744e1da9894750031 100644
--- a/SSD1306Brzo.h
+++ b/SSD1306Brzo.h
@@ -62,10 +62,10 @@ class SSD1306Brzo : public OLEDDisplay {
 
     void display(void) {
     #ifdef OLEDDISPLAY_DOUBLE_BUFFER
-       uint8_t minBoundY = ~0;
+       uint8_t minBoundY = UINT8_MAX;
        uint8_t maxBoundY = 0;
 
-       uint8_t minBoundX = ~0;
+       uint8_t minBoundX = UINT8_MAX;
        uint8_t maxBoundX = 0;
 
        uint8_t x, y;
@@ -89,7 +89,7 @@ class SSD1306Brzo : public OLEDDisplay {
        // If the minBoundY wasn't updated
        // we can savely assume that buffer_back[pos] == buffer[pos]
        // holdes true for all values of pos
-       if (minBoundY == ~0) return;
+       if (minBoundY == UINT8_MAX) return;
 
        sendCommand(COLUMNADDR);
        sendCommand(minBoundX);
diff --git a/SSD1306Spi.h b/SSD1306Spi.h
index 5a311bad07b71f6f9048e5fabb93055739d67fcf..988dc2c577b9a615f76a7e80df44a08b179341ab 100644
--- a/SSD1306Spi.h
+++ b/SSD1306Spi.h
@@ -74,10 +74,10 @@ class SSD1306Spi : public OLEDDisplay {
 
     void display(void) {
     #ifdef OLEDDISPLAY_DOUBLE_BUFFER
-       uint8_t minBoundY = ~0;
+       uint8_t minBoundY = UINT8_MAX;
        uint8_t maxBoundY = 0;
 
-       uint8_t minBoundX = ~0;
+       uint8_t minBoundX = UINT8_MAX;
        uint8_t maxBoundX = 0;
 
        uint8_t x, y;
@@ -101,7 +101,7 @@ class SSD1306Spi : public OLEDDisplay {
        // If the minBoundY wasn't updated
        // we can savely assume that buffer_back[pos] == buffer[pos]
        // holdes true for all values of pos
-       if (minBoundY == ~0) return;
+       if (minBoundY == UINT8_MAX) return;
 
        sendCommand(COLUMNADDR);
        sendCommand(minBoundX);
diff --git a/SSD1306Wire.h b/SSD1306Wire.h
index 60c1d42eb7200e2299a94ef5c5b130114c637733..a3d0a055a7744673fbaef4e64e4c1b9b1543b7c9 100644
--- a/SSD1306Wire.h
+++ b/SSD1306Wire.h
@@ -62,10 +62,10 @@ class SSD1306Wire : public OLEDDisplay {
       initI2cIfNeccesary();
       const int x_offset = (128 - this->width()) / 2;
       #ifdef OLEDDISPLAY_DOUBLE_BUFFER
-        uint8_t minBoundY = ~0;
+        uint8_t minBoundY = UINT8_MAX;
         uint8_t maxBoundY = 0;
 
-        uint8_t minBoundX = ~0;
+        uint8_t minBoundX = UINT8_MAX;
         uint8_t maxBoundX = 0;
         uint8_t x, y;
 
@@ -89,7 +89,7 @@ class SSD1306Wire : public OLEDDisplay {
         // we can savely assume that buffer_back[pos] == buffer[pos]
         // holdes true for all values of pos
 
-        if (minBoundY == (uint8_t)(~0)) return;
+        if (minBoundY == UINT8_MAX) return;
 
         sendCommand(COLUMNADDR);
         sendCommand(x_offset + minBoundX);