return true;
}
+insert_empty :: (arr: ^[..] $T, idx: u32) -> bool {
+ if !ensure_capacity(arr, arr.count + 1) do return false;
+
+ arr.count += 1;
+ while i := arr.count; i > idx {
+ arr.data[i] = arr.data[i - 1];
+ i -= 1;
+ }
+
+ return true;
+}
+
remove :: (arr: ^[..] $T, elem: T) {
move := 0;
},
}
-alloc_copy :: (orig: str) -> str {
+alloc_copy :: (orig: str, allocator := context.allocator) -> str {
new_str : str;
- new_str.data = calloc(sizeof u8 * orig.count);
+ new_str.data = raw_alloc(allocator, sizeof u8 * orig.count);
new_str.count = orig.count;
copy(orig, new_str);
return new_str;
}
+// @Speed: This should use memory.copy?
copy :: (orig: str, dest: str) {
len := orig.count;
if dest.count < len do len = dest.count;
-List of known bugs:
\ No newline at end of file
+List of known bugs:
+
+[ ] Enum parsing causes segfaults if the syntax is not EXACTLY what is expected. Some cases that break:
+ enum { Foo, Bar, Baz };
+ enum { Foo; Bar; Baz };
+
+[ ] Aliasing in many cases does not work. For example:
+
+ arr.data[idx] = x;
+ SomeNamespace :: struct {
+ foo :: () { ... }
+ bar :: ...
+ }
+
+ {
+ SN :: SomeNamespace
+
+ SN.foo()
+ }