mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-30 09:11:48 -07:00
Add core:slice.size to get the byte size of a slice's backing data
This commit is contained in:
@@ -471,6 +471,12 @@ is_empty :: proc(a: $T/[]$E) -> bool {
|
|||||||
return len(a) == 0
|
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)
|
@(require_results)
|
||||||
|
|||||||
Reference in New Issue
Block a user