Add core:slice.size to get the byte size of a slice's backing data

This commit is contained in:
Bazzagibbs
2024-11-11 14:04:59 +11:00
parent da196a2b74
commit cb0c1663b7

View File

@@ -471,6 +471,12 @@ is_empty :: proc(a: $T/[]$E) -> bool {
return len(a) == 0
}
// Gets the byte size of the backing data
@(require_results)
size :: proc "contextless" (a: $T/[]$E) -> int {
return len(a) * size_of(E)
}
@(require_results)