size_of
size_of[type: AnyType, target: __mlir_type.`!kgen.target` = _current_target()]() -> Int
Returns the size of (in bytes) of the type.
Example:
from std.sys.info import size_of
def main() raises:
print(
size_of[UInt8]() == 1,
size_of[UInt16]() == 2,
size_of[Int32]() == 4,
size_of[Float64]() == 8,
size_of[
SIMD[DType.uint8, 4]
]() == 4,
)
Note: align_of is in same module.
Parameters:
- type (
AnyType): The type in question. - target (
__mlir_type.`!kgen.target`): The target architecture.
Returns:
Int: The size of the type in bytes.