ENEL400 / RingBuffer

Dependents:   AwsomeStation LoRaBaseStation LoRaTerminal

Files at this revision

API Documentation at this revision

Comitter:
rba90
Date:
Sat Sep 03 05:41:23 2016 +0000
Parent:
5:021f688bfdaa
Child:
7:3e06927ef5ec
Commit message:
fix a bug where size_t is always positive

Changed in this revision

RingBuffer.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/RingBuffer.cpp	Fri Sep 02 03:23:04 2016 +0000
+++ b/RingBuffer.cpp	Sat Sep 03 05:41:23 2016 +0000
@@ -100,27 +100,13 @@
 template <typename T>
 T CircularBuffer<T>::first()
 {
-    if (read_ptr > 0)
-    {
-        return data[read_ptr - 1];   
-    }
-    else
-    {
-        return data[read_ptr];
-    }
+    return data[read_ptr];
 }
 
 template <typename T>
 T CircularBuffer<T>::last()
 {
-    if (write_ptr > 0)
-    {
-        return data[write_ptr - 1];   
-    }
-    else
-    {
-        return data[write_ptr];
-    }
+    return data[write_ptr];
 }
 
 template <typename T>