From: Patrick Hurley Date: 2007-04-24T09:41:39+09:00 Subject: Re: Memory alignment On 4/22/07, Timothy Hunter 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