TypeSize
Function Usage
Calculates the number of bytes occupied by an element of the input data type. For a data type whose size is less than 1 byte, 1000 is added to the basic bit size. For example, if the data type is int4, 1004 is returned, indicating that an element occupies 4 bits.
Prototype
size_t TypeSize(DataType dataType)
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
dtype |
Input |
Input data type. The size of a single element of the data type is returned. |
Returns
Size of a single element of the input data type.
Constraints
None
Example
1 2 3 4 | // Obtain the size of a single element of the data type. void Func(const DataType dtype) { size_t size = TypeSize(dtype); } |
Parent topic: data_type_utils