MCPcopy Create free account
hub / github.com/Ralim/usb-pd / push

Method push

include/ringbuffer.h:12–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10 explicit ringbuffer() : begin(0), end(0), wrap(false) {}
11
12 void push(const T *data) {
13
14 memcpy(buffer + end, data, sizeof(T));
15 // If going to wrap, push start along to maintain order
16 if (begin == end && wrap) {
17 begin = (begin + 1) % size;
18 }
19 end = (end + 1) % size;
20 if (begin == end) {
21 wrap = true;
22 }
23 }
24 // Give null to just drop the data
25 void pop(T *dest) {
26 if (getOccupied() == 0) {

Callers 3

readPendingMessageMethod · 0.80
addToFIFOMethod · 0.80
TESTFunction · 0.80

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.64