Newbie cache alignment question.

D

Daniel Seitz

John Edwards wrote in message ...
Forgive the newbie-type question, but I have a structure that
I'm trying to make 32 byte aligned for cache efficiency.

I've consulted various sources on this but can't seem to
come up with a viable soution. My guess is extra padding?

Pretty much. Some compilers have #pragma directives that'll do this for you
as well. But adding an unused variable (or two) will work well.
 
J

John Edwards

Forgive the newbie-type question, but I have a structure that
I'm trying to make 32 byte aligned for cache efficiency.

I've consulted various sources on this but can't seem to
come up with a viable soution. My guess is extra padding?



The entire structure definition:



#ifdef _MY_ARRAY_ACCESS_STRUCT

struct MYArray
{
MYInt8 *yArrayBuffer;
MYSize itemCount;
MYSize itemSize;
MYSize capacity;
};

#endif


typedef struct MYArray MYArray;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top