comparison base/ResizeableBitset.h @ 124:4ab844784152

* 1507728: Crash when creating spectrogram of small soundfiles
author Chris Cannam
date Mon, 19 Jun 2006 14:19:55 +0000
parents 534373d65f39
children 146eb9e35baa
comparison
equal deleted inserted replaced
123:0f37e92e1782 124:4ab844784152
43 void resize(size_t bits) { // losing all data 43 void resize(size_t bits) { // losing all data
44 if (!m_bits || bits < m_bits->size()) { 44 if (!m_bits || bits < m_bits->size()) {
45 delete m_bits; 45 delete m_bits;
46 m_bits = new std::vector<uint8_t>; 46 m_bits = new std::vector<uint8_t>;
47 } 47 }
48 m_bits->assign(bits / 8, 0); 48 m_bits->assign(bits / 8 + 1, 0);
49 } 49 }
50 50
51 bool get(size_t column) const { 51 bool get(size_t column) const {
52 return ((*m_bits)[column / 8]) & (1u << (column % 8)); 52 return ((*m_bits)[column / 8]) & (1u << (column % 8));
53 } 53 }