Memory alignment

Hi,

in an C extension i need to generate ruby strings, where str->ptr is
aligned to a 16 byte boundary. This is necessary so that the data can be
used with simd engines (AltiVec, SSE, …).

Is there a way to do this?

Cheers
detlef

Detlef R. wrote:

There’s no way to tell Ruby to align its strings this way. Your only
option is to make a copy aligned to your needs.

On 4/22/07, Timothy H. [email protected] wrote:

detlef

There’s no way to tell Ruby to align its strings this way. Your only option is to make a copy aligned to your needs.

Without looking at the ruby source code to see if there is a hack for
alignment, one thought that occurs is to create your string 16 bytes
larger than required – find the correct offset that is aligned, do
the work and then adjust the string as necessary to the correct start.

pth