From: Mathieu Desnoyers Date: Wed, 10 Feb 2010 20:21:44 +0000 (-0500) Subject: Revert to alignment on max(architecture size) X-Git-Tag: v0.12.30~2 X-Git-Url: http://git.liburcu.org/?p=lttv.git;a=commitdiff_plain;h=a948b7216c702765b12273c2468ce52df8b0f42b Revert to alignment on max(architecture size) Finally, noticed that gcc aligns uint64_t on 32-bit for 32-bit architectures. Hopefully we are not facing a case where different compilers behave differently. Signed-off-by: Mathieu Desnoyers --- diff --git a/ltt/ltt-private.h b/ltt/ltt-private.h index 5f791972..e432dc5b 100644 --- a/ltt/ltt-private.h +++ b/ltt/ltt-private.h @@ -196,23 +196,24 @@ struct LttSystemDescription { /* * Calculate the offset needed to align the type. - * If alignment is 0, alignment is disactivated. + * If alignment is 0, alignment is deactivated. * else, the function returns the offset needed to * align align_drift on the alignment value. * - * Do not limit alignment on architecture size anymore, - * because uint64_t types are aligned on 64-bit even - * on 32-bit archs. + * align align_drift on the alignment value (should be + * the size of the architecture). */ static inline unsigned int ltt_align(size_t align_drift, size_t size_of_type, size_t alignment) { + size_t align_offset = min(alignment, size_of_type); + if(!alignment) return 0; g_assert(size_of_type != 0); - return ((size_of_type - align_drift) & (size_of_type - 1)); + return ((align_offset - align_drift) & (align_offset-1)); }