all repos — mgba @ 067d4c5836f3897d0d66b8051c8dd67c8d3093c8

mGBA Game Boy Advance Emulator

Util: RingFIFO should be able to advance without memcpy
Jeffrey Pfau jeffrey@endrift.com
Sat, 06 Aug 2016 22:05:46 -0700
commit

067d4c5836f3897d0d66b8051c8dd67c8d3093c8

parent

4a1fc1caf8e47237ad8542be0812a4fe40919777

1 files changed, 6 insertions(+), 2 deletions(-)

jump to
M src/util/ring-fifo.csrc/util/ring-fifo.c

@@ -43,7 +43,9 @@ }

if (remaining <= length) { return 0; } - memcpy(data, value, length); + if (value) { + memcpy(data, value, length); + } buffer->writePtr = (void*) ((intptr_t) data + length); return length; }

@@ -63,7 +65,9 @@ }

if (remaining <= length) { return 0; } - memcpy(output, data, length); + if (output) { + memcpy(output, data, length); + } buffer->readPtr = (void*) ((intptr_t) data + length); return length; }