ossp-pkg/act/act_mem.c 1.7 -> 1.8
--- act_mem.c 2000/08/18 15:58:09 1.7
+++ act_mem.c 2000/08/20 14:46:26 1.8
@@ -42,6 +42,22 @@
void *(*act_mem_char)(const void *, unsigned char, size_t) = _act_mem_char;
int (*act_mem_cmp)(const void *, const void *, size_t) = _act_mem_cmp;
+/*
+ * Align a size to the next larger or equal size which is likely to have the
+ * longest *relevant* CPU-specific memory word alignment restrictions.
+ */
+size_t act_mem_align(size_t size)
+{
+ union mem_word {
+ void *mw_vp;
+ void (*mw_fp)(void);
+ char *mw_cp;
+ long mw_l;
+ double mw_d;
+ };
+ return ((1+((size-1) / sizeof(union mem_word))) * sizeof(union mem_word));
+}
+
/* the initialization function for the memory part */
intern int act_mem_init(void)
{
|
|