23 lines
628 B
Plaintext
23 lines
628 B
Plaintext
$OpenBSD: patch-suballoc_cpp,v 1.5 2009/09/11 16:14:01 naddy Exp $
|
|
--- suballoc.cpp.orig Mon Sep 7 17:52:05 2009
|
|
+++ suballoc.cpp Mon Sep 7 17:53:22 2009
|
|
@@ -31,12 +31,18 @@ inline void* SubAllocator::RemoveNode(int indx)
|
|
return RetVal;
|
|
}
|
|
|
|
+#define PAD __alignof__(void *)
|
|
+#define ROUND(v) ((v) & (PAD - 1) ? ((v) + PAD) & ~(PAD - 1) : (v))
|
|
|
|
inline uint SubAllocator::U2B(int NU)
|
|
{
|
|
// We calculate the size of units in bytes based on real UNIT_SIZE.
|
|
// In original implementation it was 8*NU+4*NU.
|
|
+#ifndef __STRICT_ALIGNMENT
|
|
return UNIT_SIZE*NU;
|
|
+#else
|
|
+ return (ROUND(UNIT_SIZE * NU));
|
|
+#endif
|
|
}
|
|
|
|
|