#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "ring.h"
Go to the source code of this file.
|
static uint32_t | next_power_of_two (uint32_t size) |
|
ZixRing * | zix_ring_new (uint32_t size) |
|
void | zix_ring_free (ZixRing *ring) |
|
void | zix_ring_mlock (ZixRing *ring) |
|
void | zix_ring_reset (ZixRing *ring) |
|
static uint32_t | read_space_internal (const ZixRing *ring, uint32_t r, uint32_t w) |
|
uint32_t | zix_ring_read_space (const ZixRing *ring) |
|
static uint32_t | write_space_internal (const ZixRing *ring, uint32_t r, uint32_t w) |
|
uint32_t | zix_ring_write_space (const ZixRing *ring) |
|
uint32_t | zix_ring_capacity (const ZixRing *ring) |
|
static uint32_t | peek_internal (const ZixRing *ring, uint32_t r, uint32_t w, uint32_t size, void *dst) |
|
uint32_t | zix_ring_peek (ZixRing *ring, void *dst, uint32_t size) |
|
uint32_t | zix_ring_read (ZixRing *ring, void *dst, uint32_t size) |
|
uint32_t | zix_ring_skip (ZixRing *ring, uint32_t size) |
|
uint32_t | zix_ring_write (ZixRing *ring, const void *src, uint32_t size) |
|
◆ ZIX_FULL_BARRIER
#define ZIX_FULL_BARRIER |
( |
| ) |
|
◆ ZIX_MLOCK
#define ZIX_MLOCK |
( |
|
ptr, |
|
|
|
size |
|
) |
| |
◆ ZIX_READ_BARRIER
◆ ZIX_WRITE_BARRIER
◆ next_power_of_two()
static uint32_t next_power_of_two |
( |
uint32_t |
size | ) |
|
|
inlinestatic |
◆ peek_internal()
static uint32_t peek_internal |
( |
const ZixRing * |
ring, |
|
|
uint32_t |
r, |
|
|
uint32_t |
w, |
|
|
uint32_t |
size, |
|
|
void * |
dst |
|
) |
| |
|
inlinestatic |
Definition at line 147 of file ring.cpp.
149{
151 return 0;
152 }
153
154 if (r + size < ring->
size) {
155 memcpy(dst, &ring->
buf[r],
size);
156 } else {
157 const uint32_t first_size = ring->
size - r;
158 memcpy(dst, &ring->
buf[r], first_size);
159 memcpy((
char*)dst + first_size, &ring->
buf[0],
size - first_size);
160 }
161
163}
static uint32_t read_space_internal(const ZixRing *ring, uint32_t r, uint32_t w)
uint32_t size
Size (capacity) in bytes.
References ZixRingImpl::buf, read_space_internal(), ZixRingImpl::size, and size.
Referenced by zix_ring_peek(), and zix_ring_read().
◆ read_space_internal()
static uint32_t read_space_internal |
( |
const ZixRing * |
ring, |
|
|
uint32_t |
r, |
|
|
uint32_t |
w |
|
) |
| |
|
inlinestatic |
◆ write_space_internal()
static uint32_t write_space_internal |
( |
const ZixRing * |
ring, |
|
|
uint32_t |
r, |
|
|
uint32_t |
w |
|
) |
| |
|
inlinestatic |