Revert "Optimizing bit memory ring buffer"

This reverts commit 2e2d2b3004.
This commit is contained in:
Andy CA6JAU 2018-07-05 00:11:33 -04:00
parent 2e2d2b3004
commit dedb41954f
2 changed files with 7 additions and 12 deletions

View file

@ -21,11 +21,6 @@ Boston, MA 02110-1301, USA.
#include "BitRB.h"
const uint8_t BIT_MASK_TABLE[] = {0x80U, 0x40U, 0x20U, 0x10U, 0x08U, 0x04U, 0x02U, 0x01U};
#define WRITE_BIT1(p,i,b) p[(i)>>3] = (b) ? (p[(i)>>3] | BIT_MASK_TABLE[(i)&7]) : (p[(i)>>3] & ~BIT_MASK_TABLE[(i)&7])
#define READ_BIT1(p,i) (p[(i)>>3] & BIT_MASK_TABLE[(i)&7])
CBitRB::CBitRB(uint16_t length) :
m_length(length),
m_bits(NULL),
@ -35,8 +30,8 @@ m_tail(0U),
m_full(false),
m_overflow(false)
{
m_bits = new uint8_t[length / 8U];
m_control = new uint8_t[length / 8U];
m_bits = new uint8_t[length];
m_control = new uint8_t[length];
}
uint16_t CBitRB::getSpace() const
@ -73,8 +68,8 @@ bool CBitRB::put(uint8_t bit, uint8_t control)
return false;
}
WRITE_BIT1(m_bits, m_head, bit);
WRITE_BIT1(m_control, m_head, control);
m_bits[m_head] = bit;
m_control[m_head] = control;
m_head++;
if (m_head >= m_length)
@ -91,8 +86,8 @@ bool CBitRB::get(uint8_t& bit, uint8_t& control)
if (m_head == m_tail && !m_full)
return false;
bit = READ_BIT1(m_bits, m_tail);
control = READ_BIT1(m_control, m_tail);
bit = m_bits[m_tail];
control = m_control[m_tail];
m_full = false;

View file

@ -24,7 +24,7 @@
#define VER_MAJOR "1"
#define VER_MINOR "4"
#define VER_REV "1"
#define VER_REV "0"
#define VERSION_DATE "20180705"
#if defined(ZUMSPOT_ADF7021)