]> sigrok.org Git - libsigrok.git/commit - src/hardware/kingst-la2016/protocol.c
kingst-la2016: rephrase USB bulk transfer size padding constraint
authorGerhard Sittig <redacted>
Mon, 31 Jan 2022 21:08:41 +0000 (22:08 +0100)
committerGerhard Sittig <redacted>
Sun, 6 Feb 2022 17:53:54 +0000 (18:53 +0100)
commit418dfd7ed3bb2c62c110f7924c796e126fd41e79
treefc9900f65a678db4587773f00364bfa97c757a50
parent9684b6507fd2ca750b4cb8796e4f5f34019e411b
kingst-la2016: rephrase USB bulk transfer size padding constraint

Always round up capture data USB bulk transfer sizes to full EP 6 packet
sizes. The previous implementation suggested that it's only required for
smaller transfers, but it's just a coincidence that the upper limit of
256KiB happened to also be a multiple of the 512B packet size.

It's assumed that capping at the absolute size limit and always padding
is more readable and as reliable as the previous if-else logic was.

Rephrase the round up by means of integer multiplication instead of
bit twiddling. Compilers should get what is intended, humans may prefer
to read the former.
src/hardware/kingst-la2016/protocol.c