aboutsummaryrefslogtreecommitdiff
path: root/stdlib/arrays.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-10-08 21:10:36 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-10-08 21:10:36 -0400
commit839c1983a0dad0232da3ceda9c7c02a49715453c (patch)
tree955e588981f589b780257c2a8a6fade286f41876 /stdlib/arrays.c
parent5103fde1c5e7e92f00801fb3a0e3662e436ee881 (diff)
Reduce padding needed for optional types and clean up some redundant
type padding
Diffstat (limited to 'stdlib/arrays.c')
-rw-r--r--stdlib/arrays.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/stdlib/arrays.c b/stdlib/arrays.c
index 274983b7..93676979 100644
--- a/stdlib/arrays.c
+++ b/stdlib/arrays.c
@@ -20,7 +20,7 @@ PUREFUNC static inline int64_t get_padded_item_size(const TypeInfo_t *info)
{
int64_t size = info->ArrayInfo.item->size;
if (info->ArrayInfo.item->align > 1 && size % info->ArrayInfo.item->align)
- size += info->ArrayInfo.item->align - (size % info->ArrayInfo.item->align); // padding
+ errx(1, "Item size is not padded!");
return size;
}
@@ -524,7 +524,7 @@ public int32_t Array$compare(const Array_t *x, const Array_t *y, const TypeInfo_
if (item->tag == PointerInfo || (item->tag == CustomInfo && item->CustomInfo.compare == NULL)) { // data comparison
int64_t item_padded_size = type->ArrayInfo.item->size;
if (type->ArrayInfo.item->align > 1 && item_padded_size % type->ArrayInfo.item->align)
- item_padded_size += type->ArrayInfo.item->align - (item_padded_size % type->ArrayInfo.item->align); // padding
+ errx(1, "Item size is not padded!");
if ((int64_t)x->stride == item_padded_size && (int64_t)y->stride == item_padded_size && item->size == item_padded_size) {
int32_t cmp = (int32_t)memcmp(x->data, y->data, (size_t)(MIN(x->length, y->length)*item_padded_size));