({ typeof(X) __x = (X), __y = (Y); \
(__x < __y ? __x : __y); })
+#define ROUND(V, A) \
+ ({ typeof(V) __v=(V); typeof(A) __a=(A); \
+ __a*((__v+__a-1)/__a); })
+
static inline int
atoi (const char* str)
while (*type != _C_STRUCT_E);
{
align = objc_alignof_type (type); /* padd to alignment */
- if ((acc_size % align) != 0)
- acc_size += align - (acc_size % align);
+ acc_size += ROUND (acc_size, align);
acc_size += objc_sizeof_type (type); /* add component size */
type = objc_skip_typespec (type); /* skip component */
}
{
int size = objc_sizeof_type (type);
int align = objc_alignof_type (type);
-
- if ((size % align) != 0)
- return size + align - (size % align);
- else
- return size;
+ return ROUND (size, align);
}
/*
int size = objc_sizeof_type (type);
int wordsize = sizeof (void*);
- if ((size % wordsize) != 0)
- return size + wordsize - (size % wordsize);
- else
- return size;
+ return ROUND (size, wordsize);
}
/*