My question has two parts.
- I noticed that memalign (block_size, bytes) on sparc (sun) with the cc compiler does not check that the bytes have a power of 2, and not memalign on intel linux and _aligned_malloc on the windows with the mvsc compiler, which check that the bytes are power 2 .
This is a mistake in the sun, is there a patch or do I need to write memalign myself.
In addition, I have a structure (not my code):
typedef struct CLHLockStruct {
volatile CLHLockNode CACHE_ALIGN *Tail ;
volatile CLHLockNode CACHE_ALIGN *MyNode[N_THREADS] ;
volatile CLHLockNode CACHE_ALIGN *MyPred[N_THREADS] ;
} CLHLockStruct;
I am compiling under MVSC (visual studio 2008):
CACHE_LINE_SIZE = 64
CACHE_ALIGN = __declspec(align(CACHE_LINE_SIZE))
N_THREADS = 8
sizeof(CLHLockStruct)=192
The code was originally written for the sparc architecture, and I'm trying to port it to MVSC without changing a lot of code.
memalign (CACHE_LINE_SIZE, sizeof (CLHLockStruct)), _aligned_malloc, , sizeof (CLHLockStruct) 2, , , 2.
?
EDIT1
, 2?
EDIT2
, _aligned_malloc malloc: , block_size, , 2?