summaryrefslogtreecommitdiff
path: root/tnslc/vector.tnsl
diff options
context:
space:
mode:
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++