mirror of
https://github.com/odin-lang/Odin.git
synced 2025-12-28 17:04:34 +00: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
|
||||
}
|
||||
|
||||
// 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)
|
||||
|
||||
Reference in New Issue
Block a user