+static void update_old_pins_array_initial_pins(struct srd_decoder_inst *di)
+{
+ uint8_t sample;
+ int i, byte_offset, bit_offset;
+ const uint8_t *sample_pos;
+
+ if (!di || !di->dec_channelmap)
+ return;
+
+ sample_pos = di->inbuf + ((di->abs_cur_samplenum - di->abs_start_samplenum) * di->data_unitsize);
+
+ for (i = 0; i < di->dec_num_channels; i++) {
+ if (di->old_pins_array->data[i] != SRD_INITIAL_PIN_SAME_AS_SAMPLE0)
+ continue;
+ byte_offset = di->dec_channelmap[i] / 8;
+ bit_offset = di->dec_channelmap[i] % 8;
+ sample = *(sample_pos + byte_offset) & (1 << bit_offset) ? 1 : 0;
+ di->old_pins_array->data[i] = sample;
+ }
+}
+