|
Serene Runtime 1.0.0-dev
C runtime for the Serene programming language
|
#include "serene/rt/impl/seq.h"#include <stdint.h>#include <stdio.h>#include "serene/rt/context.h"#include "serene/utils.h"Go to the source code of this file.
Macros | |
| #define | SEQ_LOG(FMT, ...) |
Functions | |
| static uint16_t | seq_depth_index (const uint8_t depth, const uint64_t index) |
| Find the array index of the given index, considering the given depth. | |
| static seq_elem_t * | seq_create_page (const srn_context_t *ctx) |
| Create a PAGE (just slots for the data). | |
| static seq_node_t * | seq_new_node (const srn_context_t *ctx) |
| static seq_node_t * | seq_new_path (const srn_context_t *ctx, uint8_t depth, seq_node_t *leaf) |
| Walk from the root to a possible leaf node and create all the inner and leaf nodes if necessary. | |
| static seq_node_t * | seq_clone_node (const srn_context_t *ctx, const seq_node_t *n) |
| Clone n into a fresh node with its own children page. | |
| static seq_node_t * | seq_push_leaf (const srn_context_t *ctx, const seq_node_t *node, uint8_t depth, uint64_t index, seq_node_t *leaf) |
| Insert leaf below node at the position of logical index index, cloning every node along the path. | |
| seq_t | seq_empty (const srn_context_t *ctx) |
| Create an empty seq pinned to ctx. | |
| seq_t | seq_push (const seq_t *seq, seq_elem_t x) |
| seq_lookup_result_t | seq_get (const seq_t *seq, size_t n) |
| Negative index is not supported. | |
|
static |
Clone n into a fresh node with its own children page.
Slots are copied by reference, so one slot of the clone can change without touching the original.
Definition at line 71 of file seq.c.
|
inlinestatic |
|
inlinestatic |
|
nodiscard |
Create an empty seq pinned to ctx.
The pinned context owns every allocation the seq (and all of its future versions) retains, so pick a context that lives at least as long as the seq.
Definition at line 100 of file seq.c.
|
nodiscard |
Negative index is not supported.
Definition at line 205 of file seq.c.
|
inlinestatic |
|
static |
Walk from the root to a possible leaf node and create all the inner and leaf nodes if necessary.
We use this only when we insert new data
Definition at line 58 of file seq.c.
|
nodiscard |
Definition at line 113 of file seq.c.
|
static |
Insert leaf below node at the position of logical index index, cloning every node along the path.
Nothing reachable from node is written, so older versions sharing this subtree stay intact.
Definition at line 82 of file seq.c.