Revert "Optimizing bit memory ring buffer"

This reverts commit 2e2d2b3004.
pull/47/head
Andy CA6JAU 8 years ago
parent 2e2d2b3004
commit dedb41954f

@ -21,11 +21,6 @@ Boston, MA 02110-1301, USA.
#include "BitRB.h" #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) : CBitRB::CBitRB(uint16_t length) :
m_length(length), m_length(length),
m_bits(NULL), m_bits(NULL),
@ -35,8 +30,8 @@ m_tail(0U),
m_full(false), m_full(false),
m_overflow(false) m_overflow(false)
{ {
m_bits = new uint8_t[length / 8U]; m_bits = new uint8_t[length];
m_control = new uint8_t[length / 8U]; m_control = new uint8_t[length];
} }
uint16_t CBitRB::getSpace() const uint16_t CBitRB::getSpace() const
@ -73,8 +68,8 @@ bool CBitRB::put(uint8_t bit, uint8_t control)
return false; return false;
} }
WRITE_BIT1(m_bits, m_head, bit); m_bits[m_head] = bit;
WRITE_BIT1(m_control, m_head, control); m_control[m_head] = control;
m_head++; m_head++;
if (m_head >= m_length) 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) if (m_head == m_tail && !m_full)
return false; return false;
bit = READ_BIT1(m_bits, m_tail); bit = m_bits[m_tail];
control = READ_BIT1(m_control, m_tail); control = m_control[m_tail];
m_full = false; m_full = false;

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

Loading…
Cancel
Save

Powered by TurnKey Linux.