diff options
author | Kyle Gunger <kgunger12@gmail.com> | 2023-07-26 00:48:43 -0400 |
---|---|---|
committer | Kyle Gunger <kgunger12@gmail.com> | 2023-07-26 00:48:43 -0400 |
commit | 7f0e6ea654037eda11c2e84946f99bad3f1ab6e4 (patch) | |
tree | 88aae0b23c8cdcaaa4a80daf44f87e1969b71de4 /tnslc/vector.tnsl | |
parent | ceaeb8df4d9bf9b518239ea623d813add5a71072 (diff) |
Division fixes
Diffstat (limited to 'tnslc/vector.tnsl')
-rw-r--r-- | tnslc/vector.tnsl | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tnslc/vector.tnsl b/tnslc/vector.tnsl index ecb52e1..f7ca9bc 100644 --- a/tnslc/vector.tnsl +++ b/tnslc/vector.tnsl @@ -10,7 +10,9 @@ struct Vector { /; resize (uint num_el) self.dat_size = num_el + _print_num(~_ptr{0}, ~self.dat) self.dat = _realloc(self.dat, num_el * self.el_size) + _print_num(~_ptr{0}, ~self.dat) ;/ /; get (uint i) [~uint8] @@ -39,9 +41,11 @@ struct Vector { /; pop self.num_el-- - /; if (self.num_el !== 0 && self.num_el < self.dat_size / 4) + /; if (self.num_el > 0 && self.num_el < self.dat_size / 4) self.resize(self.dat_size / 2) - ;/ + ;; else if (self.num_el < 0) + self.num_el = 0 + ;/ ;/ /; remove (int index) |