Patrick Hurley
4/24/2007 12:42:00 AM
On 4/22/07, Timothy Hunter <TimHunter@nc.rr.com> wrote:
> Detlef Reichl wrote:
> > 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
> >
> >
> 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