diff options
author | Josh Blum | 2012-09-12 23:00:54 -0700 |
---|---|---|
committer | Josh Blum | 2012-09-12 23:00:54 -0700 |
commit | 87cd4fe7179a55f1ea34ea90744017c403838542 (patch) | |
tree | b5dc5037f8b63535e5f74e9f27817e4f2fa9af1e /lib/gras_impl/input_buffer_queues.hpp | |
parent | c4785d122c6c0c0bd3163db1b9201eab9e286d5b (diff) | |
download | sandhi-87cd4fe7179a55f1ea34ea90744017c403838542.tar.gz sandhi-87cd4fe7179a55f1ea34ea90744017c403838542.tar.bz2 sandhi-87cd4fe7179a55f1ea34ea90744017c403838542.zip |
added inlining logic for input queue handling
Diffstat (limited to 'lib/gras_impl/input_buffer_queues.hpp')
-rw-r--r-- | lib/gras_impl/input_buffer_queues.hpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/gras_impl/input_buffer_queues.hpp b/lib/gras_impl/input_buffer_queues.hpp index 44abcf1..2188509 100644 --- a/lib/gras_impl/input_buffer_queues.hpp +++ b/lib/gras_impl/input_buffer_queues.hpp @@ -53,7 +53,7 @@ struct InputBufferQueues * Otherwise, resolve pointers to the input buffer, * moving the memory and length by num history bytes. */ - SBuffer front(const size_t i); + SBuffer front(const size_t i, bool &potential_inline); /*! * Rules for consume: @@ -184,19 +184,25 @@ inline void InputBufferQueues::init( } -inline SBuffer InputBufferQueues::front(const size_t i) +inline SBuffer InputBufferQueues::front(const size_t i, bool &potential_inline) { //if (_queues[i].empty()) return BuffInfo(); ASSERT(not _queues[i].empty()); ASSERT(this->ready(i)); __prepare(i); - SBuffer &front = _queues[i].front(); - SBuffer buff = front; //copy new settings + const bool unique = front.unique(); + + //same buffer, different offset and length + SBuffer buff = front; buff.offset -= _history_bytes[i]; buff.length /= _multiple_bytes[i]; buff.length *= _multiple_bytes[i]; + + //set the flag that this buffer *might* be inlined as an output buffer + potential_inline = unique and (_history_bytes[i] == 0) and (buff.length == front.length); + return buff; } |