comedi_sample_shift(9)
β¨ comedi_sample_shift(9) β¨
okay so bestie, welcome to the comedi_sample_shift(9) page β yes it's a section 9 Kernel API Manual situation, and yes it's exactly as cute as it sounds (it's a tiny little helper function, honestly iconic of it). π
πΈ SYNOPSIS πΈ
unsigned int comedi_sample_shift (struct comedi_subdevice *s );
like, that's the whole function signature, no notes, she's simple and she works π«Ά
π ARGUMENTS π
sβ your COMEDI subdevice. your blorbo. the subdevice in question. that's the whole arg, one (1) subdevice, and she has to be astruct comedi_subdevice *.
π¦ DESCRIPTION π¦
okay so here's the vibe: your sample size is gonna be 4 (sizeof int) or 2 (sizeof short), and which one it is depends entirely on whether the SDF_LSAMPL subdevice flag is set or not. like, flag set β one size, flag not set β the other. the way that it hinges on one single flag?? highkey elegant.
so the log2 of that sample size is gonna be 2 or 1 respectively, and here's the slay part: you can use that number as the right operand of a bit-shift operator to multiply or divide something by the sample size. shifting instead of multiplying, no cap, it's giving optimization main character energy π₯
π RETURN π
returns the log2 of the subdevice sample size. that's it. that's the return value. unsigned int, log2, sample size, periodt. β¨
π SEE ALSO π
- the kernel file
./include/linux/comedi/comedidev.h(specificallystruct comedi_subdevice(9)) struct comedi_buf_page(9)struct comedi_buf_map(9)struct comedi_async(9)enum comedi_cb(9)struct comedi_driver(9)struct comedi_device(9)struct comedi_lrange(9)comedi_range_is_bipolar(9)comedi_range_is_unipolar(9)comedi_range_is_external(9)comedi_chan_range_is_bipolar(9)comedi_chan_range_is_unipolar(9)comedi_chan_range_is_external(9)comedi_offset_munge(9)comedi_bytes_per_sample(9)comedi_bytes_to_samples(9)comedi_samples_to_bytes(9)comedi_check_trigger_src(9)comedi_check_trigger_is_unique(9)comedi_check_trigger_arg_is(9)comedi_check_trigger_arg_min(9)comedi_check_trigger_arg_max(9)comedi_buf_n_bytes_ready(9)__comedi_request_region(9)comedi_request_region(9)module_comedi_driver(9)
like that's the whole friend group, read up on all of them, iykyk π
lowkey a reminder that this page is from<pink>./include/linux/comedi</pink>, dropped in October 2026, living in the Kernel API Manual, and it is, always and forever, thecomedi_sample_shift(9)page. mwah π π§ββοΈπΈ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms