core.ds.types¶
Shared type definitions for all kernel data structures.
Overview¶
core.ds.types is a types-only unit that declares the record and pointer types used by the data structure units in the core.ds namespace. Centralising these definitions allows different data structure units to share types without circular dependencies. No functions or variables are defined here.
Dependencies¶
None.
Types¶
TQueueNode / PQueueNode¶
Singly-linked node used by the linked-list FIFO (core.ds.fifo) and LIFO (core.ds.lifo) implementations. Data points to a heap-allocated copy of the stored element.
TFIFOQueue / PFIFOQueue¶
TFIFOQueue = record
Head : PQueueNode;
Tail : PQueueNode;
Count : uint32;
ElementSize : uint32;
end;
Head is the dequeue end; Tail is the enqueue end.
TCFIFOQueue / PCFIFOQueue¶
TCFIFOQueue = record
Data : void;
Head : uint32;
Count : uint32;
Capacity : uint32;
ElementSize : uint32;
end;
Data + (Head * ElementSize). When Head advances past half the capacity, elements are shifted back to index 0. The buffer doubles when full.
TCFIFOList / PCFIFOList¶
Dynamic array ofPCFIFOQueue pointers. Used to group related contiguous FIFO queues. Items is a flat buffer of pointer slots that grows automatically.
TLIFOStack / PLIFOStack¶
Last-In First-Out stack backed by a singly-linked list.Top points to the most recently pushed node.
TCircularQueue / PCircularQueue¶
TCircularQueue = record
Data : void;
Head : uint32;
Tail : uint32;
Count : uint32;
Capacity : uint32;
ElementSize : uint32;
end;
Head is the index of the front element; Tail is the index of the next free slot. Wrap-around is handled with modulo arithmetic.
TBinaryHeap / PBinaryHeap¶
TBinaryHeap = record
Data : void;
Indices : void;
FreeSlots : void;
Count : uint32;
Capacity : uint32;
NextSlot : uint32;
FreeCount : uint32;
ElementSize : uint32;
NodeStride : uint32;
IsMinHeap : boolean;
end;
Data as [Priority (uint32)][Element (ElementSize bytes)] per slot. Indices maps heap positions to data slot indices, allowing O(1) swaps by exchanging indices rather than copying data. Freed data slots are recycled through FreeSlots/FreeCount. IsMinHeap controls whether the root holds the minimum (true) or maximum (false) priority.
TBloomFilter / PBloomFilter¶
Probabilistic set-membership filter.Bits is a flat byte buffer of ceil(BitCount / 8) bytes. Membership tests use k = HashCount independent bit positions derived from two base hashes (FNV-1a + DJB2) via double hashing: h_i(x) = (h1(x) + i * h2(x)) mod BitCount. False positives are possible; false negatives are not.