Memory alignment of arrays

后端 未结 3 1766
广开言路
广开言路 2020-12-19 03:08

I am having trouble aligning memory for DMA transfer on the Cell processor. I need the last 4 bits of an address to be 0.

I have 4 arrays of unsigned int

3条回答
  •  轮回少年
    2020-12-19 03:54

    I really don't think you can do that ... You're trying to get the compiler to inject extra padding for alighment purposes "inside" an unsigned int. But there's no space to do that, all of the bits in an unsigned int are already used for the integer itself.

    I think the solution is to wrap the integer in a structure, since then you can use the __attribute__(()) magic on the structure, and make an array of that.

提交回复
热议问题