[riot-notifications] [RIOT-OS/RIOT] tsrb: change input type to `uint8_t` (#11634)
notifications at github.com
Wed Jun 5 13:24:46 CEST 2019
smlng requested changes on this pull request.
rb->buf[rb->writes++ & (rb->size - 1)] = c;
-static char _pop(tsrb_t *rb)
+static uint8_t _pop(tsrb_t *rb)
return rb->buf[rb->reads++ & (rb->size - 1)];
int tsrb_get_one(tsrb_t *rb)
why not change this to `uint8_t tsrb_get_one(tsrb_t *rb)` and remove the `-1` return, but change the documentation so that it states that the callee of this function SHOULD (or MUST) check `if (!tsrb_empty(rb))` before usage.
That way we avoid necessary casts of `int` to `uint8_t` and its safe because this whole thing assumes single produces + single consumer.
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the notifications