ListAt
ListAt
Description
Data in node at given index in given list This is a more expensive call. Fetches pointer to data twice and then dereferences. Better use ListPtrAt instead.
Parameters
| Name | Direction | Description |
|---|---|---|
l |
in | List to get data from. |
idx |
in | Index to get data at. |
Success
Data from node in list at given index.
Failure
Emtpy object.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
ListInt.c:87:
uint16_t idx = extract_u16(data, offset, size);
if (idx < list->length) {
volatile i32 value = ListAt(list, idx);
(void)value; // Prevent optimization
}- In
Access.h:35:
#ifdef __cplusplus
# define ListAt(l, idx) (ListPtrAt((l), (idx)) ? *ListPtrAt((l), (idx)) : (LIST_DATA_TYPE(l) {0}))
#else
///
- In
Access.h:59:
/// FAILURE: Emtpy object.
///
#define ListFirst(l) ListAt((l), 0)
///
- In
Access.h:69:
/// FAILURE: Emtpy object.
///
#define ListLast(l) ListAt((l), (l)->length - 1)
///
Last updated on