X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fhardware%2Fdreamsourcelab-dslogic%2Fprotocol.c;h=90b773d9cf970fe34d48193cea23de0792d046f5;hb=6c1a4cb44ccd24b2b23477c86273a8e405758c03;hp=3b4848eead90e944205a995588d7847c181de9bc;hpb=f05600f4be54c7f112815cc1624600517243898e;p=libsigrok.git diff --git a/src/hardware/dreamsourcelab-dslogic/protocol.c b/src/hardware/dreamsourcelab-dslogic/protocol.c index 3b4848ee..90b773d9 100644 --- a/src/hardware/dreamsourcelab-dslogic/protocol.c +++ b/src/hardware/dreamsourcelab-dslogic/protocol.c @@ -733,10 +733,12 @@ static void deinterleave_buffer(const uint8_t *src, size_t length, for (int bit = 0; bit != 64; bit++) { const uint64_t *word_ptr = src_ptr; sample = 0; - for (size_t channel = 0; channel != channel_count; + for (unsigned int channel = 0; channel != 16; channel++) { - if ((channel_mask & (1 << channel)) && - (*word_ptr++ & (1ULL << bit))) + const uint16_t m = channel_mask >> channel; + if (!m) + break; + if ((m & 1) && ((*word_ptr++ >> bit) & 1ULL)) sample |= 1 << channel; } *dst_ptr++ = sample;