Better HN
topnewbestaskshowjobs
Log inSign up

ghhhhhk8899jj

9 karma · joined Nov 26, 2020 (6y ago) · 6 submissions

Submissions

comment 5y ago · link · parent

Making your own custom USB device has quite a large upfront cost since you need to buy a PID/VID.

comment 5y ago · link · parent

volatile does not imply compiler fence on gcc, so this code has a race condition when updating read/write_position, you need compiler barriers here

>data[write_position] = value;

>COMPILER_BARRIER(); // __asm__ volatile("":::"memory");

>write_position = (write_position + 1U) % LENGTH;

and same in Skip()

comment 5y ago · link · parent

There's no reason to assume that code would contain fewer bugs.

comment 5y ago · link · parent

For now... Wait a few months/a year and they will find a reason to "take advantage" of that increase in performance and slow it back down again.