MCPcopy Create free account
hub / github.com/DreamSourceLab/DSView / term_matches

Function term_matches

libsigrokdecode4DSL/instance.c:887–915  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

885}
886
887static gboolean term_matches(struct srd_decoder_inst *di,
888 struct srd_term *term, gboolean *skip_allow)
889{
890 uint8_t old_sample, sample;
891 int bit_offset, ch;
892 const uint8_t *sample_pos;
893
894 /* Caller ensures di, di->dec_channelmap, term, sample_pos != NULL. */
895
896 *skip_allow = FALSE;
897 if (term->type == SRD_TERM_SKIP) {
898 if (di->abs_cur_matched && term->num_samples_to_skip == 0)
899 di->skip_zero = TRUE;
900 return sample_matches(0, 0, term);
901 }
902
903 ch = term->channel;
904 if (*(di->inbuf + ch) == NULL) {
905 sample = *(di->inbuf_const + ch) ? 1 : 0;
906 *skip_allow = TRUE;
907 } else {
908 sample_pos = *(di->inbuf + ch) + ((di->abs_cur_samplenum - di->abs_start_samplenum) / 8);
909 bit_offset = (di->abs_cur_samplenum - di->abs_start_samplenum) % 8;
910 sample = *sample_pos & (1 << bit_offset) ? 1 : 0;
911 }
912 old_sample = di->old_pins_array->data[ch];
913
914 return sample_matches(old_sample, sample, term);
915}
916
917static gboolean all_terms_match(struct srd_decoder_inst *di,
918 const GSList *cond, gboolean *skip_allow)

Callers 1

all_terms_matchFunction · 0.85

Calls 1

sample_matchesFunction · 0.85

Tested by

no test coverage detected