summaryrefslogtreecommitdiff
path: root/lib/gras_impl/input_buffer_queues.hpp
diff options
context:
space:
mode:
authorJosh Blum2012-10-14 21:06:43 -0700
committerJosh Blum2012-10-14 21:06:43 -0700
commit5b924be64e1ada926c514058b97e3f7528c8ac7d (patch)
tree3b0a5076f53d11de1a11621508d5c3a90b9c6e22 /lib/gras_impl/input_buffer_queues.hpp
parentabc6715098cc5ca4d83d1227b2c9ca98e33b4a86 (diff)
downloadsandhi-5b924be64e1ada926c514058b97e3f7528c8ac7d.tar.gz
sandhi-5b924be64e1ada926c514058b97e3f7528c8ac7d.tar.bz2
sandhi-5b924be64e1ada926c514058b97e3f7528c8ac7d.zip
added input fail logic to conditionally accumulate
Diffstat (limited to 'lib/gras_impl/input_buffer_queues.hpp')
-rw-r--r--lib/gras_impl/input_buffer_queues.hpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/gras_impl/input_buffer_queues.hpp b/lib/gras_impl/input_buffer_queues.hpp
index 1b663c3..d17c4f0 100644
--- a/lib/gras_impl/input_buffer_queues.hpp
+++ b/lib/gras_impl/input_buffer_queues.hpp
@@ -58,6 +58,19 @@ struct InputBufferQueues
void accumulate(const size_t i, const size_t item_size);
+ /*!
+ * Can we consider this queue's buffers to be accumulated?
+ * Either the first buffer holds all of the enqueued bytes
+ * or the first buffer is larger than we can accumulate.
+ */
+ GRAS_FORCE_INLINE bool is_accumulated(const size_t i) const
+ {
+ ASSERT(not _queues[i].empty());
+ return
+ (_queues[i].front().length == _enqueued_bytes[i]) or
+ (_queues[i].front().length >= MAX_AUX_BUFF_BYTES);
+ }
+
GRAS_FORCE_INLINE void push(const size_t i, const SBuffer &buffer)
{
ASSERT(not _queues[i].full());
@@ -182,7 +195,8 @@ GRAS_FORCE_INLINE void InputBufferQueues::accumulate(const size_t i, const size_
}
_queues[i].push_front(accum_buff);
- return;
+
+ ASSERT(this->is_accumulated(i));
}
GRAS_FORCE_INLINE void InputBufferQueues::consume(const size_t i, const size_t bytes_consumed)