44 uint32_t* new_list = NULL;
45 if (array->
data == NULL)
47 new_list = calloc(1,
sizeof(uint32_t));
52 new_list = array->
data;
56 size_t newCount = (array->
length + 1);
57 new_list = realloc(array->
data, newCount *
sizeof(uint32_t));
62 array->
data = new_list;
77 if (array != NULL && array->
data != NULL)
79 if (removeIndex >= 0 && (
size_t)removeIndex < array->length)
81 for (
size_t index = removeIndex; index < array->
allocatedLength - 1; index++)
83 array->
data[index] = array->
data[index + 1];
97 if (array != NULL && array->
data != NULL)
99 for (
size_t index = 0; index < array->
length; index++)
101 if (array->
data[index] == value)
103 foundIndex = (int)index;
118 bool success =
false;
120 if (sourceArray != NULL && destinationArray != NULL)
122 if (sourceArray->
data != NULL)
126 uint32_t* new_list = malloc(new_size);
127 if (new_list != NULL)
129 memcpy(new_list, sourceArray->
data, new_size);
130 destinationArray->
data = new_list;
Represents an array of 32-bit unsigned integers. The data field points to a block of memory allocated...
size_t allocatedLength
Number of elements that the data array can hold.
uint32_t * data
Pointer to array of 32-bit unsigned integers.
size_t length
Number of 32-bit unsigned integers actually in the data array.
void UIntArray_Initialize(UIntArray *array)
Initialize the given UIntArray object.
int UIntArray_Find(UIntArray *array, uint32_t value)
Search the given UIntArray object for the specified value and return the index of that found value.
bool UIntArray_Copy(UIntArray *sourceArray, UIntArray *destinationArray)
Copy the source UIntArray to the destination UIntArray. The destination UIntArray is erased before ge...
void UIntArray_Clear(UIntArray *array)
Clear the given UIntArray object so it can be reused again. Releases the list of integers.
bool UIntArray_AddInt(UIntArray *array, uint32_t value)
Add an unsigned 32-bit integer to the given UIntArray object.
void UIntArray_RemoveInt(UIntArray *array, int removeIndex)
Remove the unsigned 32-bit integer from the given UIntArray object at the given index....
Declaration of the UIntArray structure and the supporting functions that represents an array of 32-bi...