// Check if we reached the last block at this level,
// or if there was a change in this block
if(offset >= _mip_map[level].length ||
- (*(uint64_t*)((uint8_t*)_mip_map[level].data +
- _unit_size * offset) & sig_mask))
+ (get_subsample(level, offset) & sig_mask))
break;
if((offset & ~(~0 << MipMapScalePower)) == 0)
// Check if we reached the last block at this level,
// or if there was a change in this block
if(offset >= _mip_map[level].length ||
- (*(uint64_t*)((uint8_t*)_mip_map[level].data +
- _unit_size * offset) & sig_mask))
+ (get_subsample(level, offset) & sig_mask))
{
// Zoom in unless we reached the minimum zoom
if(level == min_level)
get_sample(end) & sig_mask));
}
+uint64_t LogicDataSnapshot::get_subsample(int level, uint64_t offset) const
+{
+ assert(level >= 0);
+ assert(_mip_map[level].data);
+ return *(uint64_t*)((uint8_t*)_mip_map[level].data +
+ _unit_size * offset);
+}
+
int64_t LogicDataSnapshot::pow2_ceil(int64_t x, unsigned int power)
{
const int64_t p = 1 << power;
float min_length, int sig_index);
private:
+ uint64_t get_subsample(int level, uint64_t offset) const;
static int64_t pow2_ceil(int64_t x, unsigned int power);
BOOST_TEST_MESSAGE("Testing mip_map[0].data[" << i << "]");
const uint8_t sample = (uint8_t)((i*16) >> 8);
- BOOST_CHECK_EQUAL(*((uint8_t*)s._mip_map[0].data + i++),
+ BOOST_CHECK_EQUAL(s.get_subsample(0, i++) & 0xFF,
prev_sample ^ sample);
prev_sample = sample;
for(int j = 1; i < s._mip_map[0].length && j < 16; j++)
{
BOOST_TEST_MESSAGE("Testing mip_map[0].data[" << i << "]");
- BOOST_CHECK_EQUAL(*((uint8_t*)s._mip_map[0].data + i++), 0);
+ BOOST_CHECK_EQUAL(s.get_subsample(0, i++) & 0xFF, 0);
}
}
const uint8_t expected = sample ^ prev_sample;
prev_sample = i;
- BOOST_CHECK_EQUAL(*((uint8_t*)s._mip_map[1].data + i),
- expected);
+ BOOST_CHECK_EQUAL(s.get_subsample(1, i) & 0xFF, expected);
}
// Check mip map level 2
const uint8_t expected = (sample ^ prev_sample) | 0x0F;
prev_sample = sample;
- BOOST_CHECK_EQUAL(*((uint8_t*)s._mip_map[2].data + i),
- expected);
+ BOOST_CHECK_EQUAL(s.get_subsample(2, i) & 0xFF, expected);
}
// Check mip map level 3