summaryrefslogtreecommitdiff
path: root/tnslc/vector.tnsl
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2024-03-25 21:56:52 -0400
committerKyle Gunger <kgunger12@gmail.com>2024-03-25 21:56:52 -0400
commit12679f9be4bd3a924ca0859a7ad133178513bace (patch)
treed671fb3b5ce776474fc5eaf691805008e87b29a5 /tnslc/vector.tnsl
parent00f4940ff1c19f3659779b2db078b85f178cb5ab (diff)
Better tmp handling
Diffstat (limited to 'tnslc/vector.tnsl')
-rw-r--r--tnslc/vector.tnsl10
1 files changed, 8 insertions, 2 deletions
diff --git a/tnslc/vector.tnsl b/tnslc/vector.tnsl
index 9b89081..e5f58eb 100644
--- a/tnslc/vector.tnsl
+++ b/tnslc/vector.tnsl
@@ -11,6 +11,8 @@ struct Vector {
int VECT_DEFAULT_SIZE = 4
int VECT_MAX_GROW = 128
+~uint8 PUSH_STR = "Push %d\n\0"
+
# Methods on the struct
/; method Vector
@@ -50,12 +52,16 @@ int VECT_MAX_GROW = 128
# Push an element onto the end of the vector
/; push (~void data)
- /; if (count == size - 1)
+ /; if (self.count == self.size - 1)
self._grow(self.size)
;/
+
+ int offset = self._elsz * self.count
/; loop (int i = 0; i < self._elsz) [i++]
- (self.data + i)` = (data + i)`
+ ~uint8 to = self.data + offset + i
+ ~uint8 from = data + i
+ to` = from`
;/
self.count++