openbsd-ports/archivers/unrar/patches/patch-suballoc_cpp

21 lines
543 B
Plaintext
Raw Normal View History

2007-05-26 12:55:53 -04:00
$OpenBSD: patch-suballoc_cpp,v 1.2 2007/05/26 16:55:53 rui Exp $
--- suballoc.cpp.orig Mon Apr 16 10:49:26 2007
+++ suballoc.cpp Sat May 26 16:38:03 2007
@@ -31,10 +31,16 @@ 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)
{
+#ifndef __STRICT_ALIGNMENT
return /*8*NU+4*NU*/UNIT_SIZE*NU;
+#else
+ return (ROUND(UNIT_SIZE * NU));
+#endif /* !__STRICT_ALIGNMENT */
}