Guard runs of debug logging with the preprocessor
Guard runs of debug logging with the preprocessor: a task in vim-headless-mastery: vim (Harbor dataset). int sampler step(struct sampler s) { int raw = adc read(s- channel); LOG DEBUG("raw=%d", raw); LOG DEBUG("offset=%d", s- offset); int level = (raw - s- offset) s- scale num / s- scale den; if…
The task
int sampler_step(struct sampler *s) { int raw = adc_read(s->channel); LOG_DEBUG("raw=%d", raw); LOG_DEBUG("offset=%d", s->offset); int level = (raw - s->offset) * s->scale_num / s->scale_den; if (level < 0) { LOG_WARN("negative level %d, clamping", level); level = 0; } LOG_DEBUG("level=%d", level);…
Part of swedishembedded/vim-headless-mastery.