diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2024-12-13 16:10:14 -0500 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2024-12-13 16:10:14 -0500 |
commit | 61e1e5ce377719c8e9e437e5ba79ba06fc1de4ba (patch) | |
tree | 10ad1cbb37ab6fc2cbfc6971f9d00c8610b77f70 /tnslc/utils/vector.tnsl | |
parent | 8bcb71c01fffa6cb576ad77f90ff3efe5c4c8fca (diff) |
Type generation for compile modulesorigin
Diffstat (limited to 'tnslc/utils/vector.tnsl')
-rw-r--r-- | tnslc/utils/vector.tnsl | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tnslc/utils/vector.tnsl b/tnslc/utils/vector.tnsl index d00d698..38c45fc 100644 --- a/tnslc/utils/vector.tnsl +++ b/tnslc/utils/vector.tnsl @@ -67,6 +67,22 @@ uint VECTOR_MAX_GROW = 256 ;/ /; pop + self.remove(self.count - 1) + ;/ + + /; remove (int index) + /; if (index < 0 || index !< self.count) + return + ;/ + + /; if (self.count > 1) + /; loop (int i = index * self._elsz; i < (self.count - 1) * self._elsz) [i++] + ~uint8 to = self.data + i + ~uint8 from = self.data + i + self._elsz + to` = from` + ;/ + ;/ + self.count-- /; if (self.count < self.size / 2) @@ -96,6 +112,25 @@ uint VECTOR_MAX_GROW = 256 self._elsz = 0 _delete(self.data) ;/ + + /; copy [Vector] + Vector out + + out.init(self._elsz) + /; loop (int i = 0; i < self.count) [i++] + ~int tmp = self.get(i) + out.push(tmp) + ;/ + + return out + ;/ + + /; back [~void] + /; if (self.count > 0) + return self.get(self.count - 1) + ;/ + return NULL + ;/ ;/ |