Browse Source

Add dynarray sizeof functions

windows-imgui
Macoy Madson 9 months ago
parent
commit
d86d24e845
  1. 14
      src/DynamicArray.cake

14
src/DynamicArray.cake

@ -43,6 +43,18 @@
(token-splice-rest body tokens)))
(return true))
(defmacro dynarray-length-sizeof (dynarray any)
(tokenize-push output
(* (dynarray-length (token-splice dynarray))
(sizeof (at 0 (token-splice dynarray)))))
(return true))
(defmacro dynarray-capacity-sizeof (dynarray any)
(tokenize-push output
(* (dynarray-capacity (token-splice dynarray))
(sizeof (at 0 (token-splice dynarray)))))
(return true))
;; Dynamic string
;; Helpers for creating auto-resizing strings
;; The underlying data structure is DynamicArray. Its functions may be used on the string
@ -143,6 +155,8 @@
(fprintf stderr "\nCapacity after all that: %d\n"
(type-cast (dynarray-capacity my-dynarray) int))
(fprintf stderr "Size of array: %d\n" (dynarray-length-sizeof my-dynarray))
(dynarray-free my-dynarray)
(return 0))

Loading…
Cancel
Save