Skip to content

Commit

Permalink
update lib_iqueue
Browse files Browse the repository at this point in the history
  • Loading branch information
devcoons committed Jan 15, 2024
1 parent 69a85fc commit 460db1f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions lib/lib_iqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@
* Definition | Public Functions
******************************************************************************/

i_status iqueue_init(iqueue_t* _queue, int _max_elements, size_t _element_size, void* _storage)
i_status iqueue_init(iqueue_t* _queue, uint32_t _max_elements, size_t _element_size, void* _storage)
{
if (_queue != NULL)
if (_queue != (void*)NULL)
{
memset(_storage, 0x00, _element_size * _max_elements);
memset(_storage, 0x00, _element_size * (size_t)_max_elements);
_queue->element_size = _element_size;
_queue->max_elements = _max_elements;
_queue->first = 0;
Expand All @@ -66,7 +66,7 @@ i_status iqueue_init(iqueue_t* _queue, int _max_elements, size_t _element_size,
return I_ERROR;
}

volatile void* iqueue_get_next_enqueue(iqueue_t* _queue)
void* iqueue_get_next_enqueue(iqueue_t* _queue)
{
return (void*)_queue->next;
}
Expand Down
14 changes: 7 additions & 7 deletions lib/lib_iqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,24 +87,24 @@ typedef enum

typedef struct
{
volatile void* storage;
volatile uintptr_t first;
volatile uintptr_t next;
volatile size_t element_size;
volatile uint32_t max_elements;
void* storage;
uintptr_t first;
uintptr_t next;
size_t element_size;
uint32_t max_elements;
}
iqueue_t;

/******************************************************************************
* Declaration | Public Functions
******************************************************************************/

i_status iqueue_init(iqueue_t* _queue, int _max_elements, size_t _element_size, void* _storage);
i_status iqueue_init(iqueue_t* _queue, uint32_t _max_elements, size_t _element_size, void* _storage);
i_status iqueue_enqueue(iqueue_t* _queue, void* _element);
i_status iqueue_dequeue(iqueue_t* _queue, void* _element);
i_status iqueue_size(iqueue_t* _queue, size_t* _size);
i_status iqueue_advance_next(iqueue_t* _queue);
volatile void* iqueue_get_next_enqueue(iqueue_t* _queue);
void* iqueue_get_next_enqueue(iqueue_t* _queue);
void* iqueue_dequeue_fast(iqueue_t* _queue);

/******************************************************************************
Expand Down

0 comments on commit 460db1f

Please sign in to comment.