Dependencies/Build/mac/include/faust/gui/ring-buffer.h
static ringbuffer_t *
ringbuffer_create (size_t sz)
{
	size_t power_of_two;
	ringbuffer_t *rb;

	if ((rb = (ringbuffer_t *) malloc (sizeof (ringbuffer_t))) == NULL) {
		return NULL;
	}

	for (power_of_two = 1u; 1u << power_of_two < sz; power_of_two++);

	rb->size = 1u << power_of_two;
	rb->size_mask = rb->size;
	rb->size_mask -= 1;
	rb->write_ptr = 0;
	rb->read_ptr = 0;
	if ((rb->buf = (char *) malloc (rb->size)) == NULL) {
		free (rb);
		return NULL;
	}
	rb->mlocked = 0;

	return rb;
}
/* Create a new ringbuffer to hold at least `sz' bytes of data. The
   actual buffer size is rounded up to the next power of two. */
Create a new ringbuffer to hold at least `sz' bytes of data. The
actual buffer size is rounded up to the next power of two.
Create a new ringbuffer to hold at least ` sz ' bytes of data . The actual buffer size is rounded up to the next power of two .
static ringbuffer_t *
ringbuffer_create (size_t sz)
{
	size_t power_of_two;
	ringbuffer_t *rb;
	if ((rb = (ringbuffer_t *) malloc (sizeof (ringbuffer_t))) == NULL) {
		return NULL;
	}
	for (power_of_two = 1u; 1u << power_of_two < sz; power_of_two++);
	rb->size = 1u << power_of_two;
	rb->size_mask = rb->size;
	rb->size_mask -= 1;
	rb->write_ptr = 0;
	rb->read_ptr = 0;
	if ((rb->buf = (char *) malloc (rb->size)) == NULL) {
		free (rb);
		return NULL;
	}
	rb->mlocked = 0;
	return rb;
}
static ringbuffer_t * ringbuffer_create ( size_t sz ) { size_t power_of_two ; ringbuffer_t * rb ; if ( ( rb = ( ringbuffer_t * ) malloc ( sizeof ( ringbuffer_t ) ) ) == NULL ) { return NULL ; } for ( power_of_two = 1u ; 1u << power_of_two < sz ; power_of_two ++ ) ; rb -> size = 1u << power_of_two ; rb -> size_mask = rb -> size ; rb -> size_mask -= 1 ; rb -> write_ptr = 0 ; rb -> read_ptr = 0 ; if ( ( rb -> buf = ( char * ) malloc ( rb -> size ) ) == NULL ) { free ( rb ) ; return NULL ; } rb -> mlocked = 0 ; return rb ; }
Create a new ringbuffer to hold at least `sz' bytes of data.
Create a new ringbuffer to hold at least ` sz ' bytes of data .