Only fields need to be memset.

This commit is contained in:
Vibi Manx 2021-09-11 00:46:58 -04:00 committed by Charles Giessen
parent ad394dce69
commit 5140be1d4d
2 changed files with 4 additions and 3 deletions

View File

@ -37,7 +37,7 @@ namespace vkb {
namespace detail {
GenericFeaturesPNextNode::GenericFeaturesPNextNode() {
memset(this, UINT8_MAX, sizeof(GenericFeaturesPNextNode));
memset(fields, UINT8_MAX, sizeof(VkBool32) * field_capacity);
}
bool GenericFeaturesPNextNode::match(

View File

@ -120,10 +120,12 @@ template <typename T> class Result {
struct GenericFeaturesPNextNode {
static const uint32_t field_capacity = 256;
GenericFeaturesPNextNode();
template <typename T> GenericFeaturesPNextNode(T const& features) noexcept {
memset(this, UINT8_MAX, sizeof(GenericFeaturesPNextNode));
memset(fields, UINT8_MAX, sizeof(VkBool32) * field_capacity);
memcpy(this, &features, sizeof(T));
}
@ -131,7 +133,6 @@ struct GenericFeaturesPNextNode {
VkStructureType sType = static_cast<VkStructureType>(0);
void* pNext = nullptr;
static const uint32_t field_capacity = 256;
VkBool32 fields[field_capacity];
};