X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=logicdatasnapshot.cpp;h=9cc7819f2b178a9ba4ca2df2bec128607164da56;hp=5301abf59d04d6920892a5b6bfaa143ebf04c9ad;hb=b2bcbe51febaef24a211ed19bc61408c8fbdc399;hpb=8743e7cba1f05ea0dde3dd566f28e6082ed055d0 diff --git a/logicdatasnapshot.cpp b/logicdatasnapshot.cpp index 5301abf5..9cc7819f 100644 --- a/logicdatasnapshot.cpp +++ b/logicdatasnapshot.cpp @@ -233,8 +233,7 @@ void LogicDataSnapshot::get_subsampled_edges( // 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) @@ -268,8 +267,7 @@ void LogicDataSnapshot::get_subsampled_edges( // 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) @@ -323,6 +321,14 @@ void LogicDataSnapshot::get_subsampled_edges( 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;