types/description: rename the size query for description to 'bytes'
This tends to cause less confusion for consumers about the exact meaning of 'size'. It gets confused with arity quite often.
This commit is contained in:
parent
7805153e17
commit
34a69f5656
@ -73,6 +73,10 @@ namespace cruft::types {
|
|||||||
/// A description of the type that makes up a scalar or vector type.
|
/// A description of the type that makes up a scalar or vector type.
|
||||||
///
|
///
|
||||||
/// A vector3f would be { REAL, sizeof(float), 3 };
|
/// A vector3f would be { REAL, sizeof(float), 3 };
|
||||||
|
///
|
||||||
|
/// DO NOT add a 'size' member function as it tends to be used in a way
|
||||||
|
/// that confuses total byte size, element byte size, and arity.
|
||||||
|
/// Instead: use the bytes member function, or the arity member variable.
|
||||||
struct description {
|
struct description {
|
||||||
/// The signed, realness, or voidness of the type.
|
/// The signed, realness, or voidness of the type.
|
||||||
enum category category;
|
enum category category;
|
||||||
@ -86,7 +90,11 @@ namespace cruft::types {
|
|||||||
std::size_t alignment;
|
std::size_t alignment;
|
||||||
|
|
||||||
/// Returns the number of bytes required to store this type.
|
/// Returns the number of bytes required to store this type.
|
||||||
constexpr std::size_t size (void) const noexcept { return width * arity; }
|
constexpr std::size_t
|
||||||
|
bytes (void) const noexcept
|
||||||
|
{
|
||||||
|
return width * arity;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user