Added use of memalign for Sun/Solaris (rather than posix_memalign).
// If available, use aligned_alloc for cache-line-aligned allocations. Otherwise
// fall back to plain malloc.
//
+
+#ifdef __sun
+#define NEW_CACHE_ALIGNED(t,p) \
+do { \
+ p = memalign(64, sizeof(t) + (sizeof(t) % 64 ? 64 - (sizeof(t) % 64) : 0)); \
+} while (0)
+
+#define ALLOC_CACHE_ALIGNED(s,p) \
+do { \
+ p = memalign(64, s + (s % 64 ? 64 - (s % 64) : 0)); \
+} while (0)
+
+
+#else
#define NEW_CACHE_ALIGNED(t,p) \
do { \
if (posix_memalign((void*) &(p), 64, (sizeof(t) + (sizeof(t) % 64 ? 64 - (sizeof(t) % 64) : 0))) != 0) (p) = 0; \
@@ -46,6 +60,7 @@ do { \
do { \
if (posix_memalign((void*) &(p), 64, (s + (s % 64 ? 64 - (s % 64) : 0))) != 0) (p) = 0; \
} while (0)
+#endif
#define ZERO(p) memset(p, 0, sizeof(*p))
