Re: [swift-users] raw buffer pointer load alignment

2017-11-10 Thread Joe Groff via swift-users
> On Nov 8, 2017, at 5:41 PM, Kelvin Ma via swift-users > wrote: > > yikes there’s no less verbose way to do that? and if the type isn’t an > integer there’s no way to avoid the default initialization? Can this be done > with opaques or something? It would be reasonable to put this all in e

Re: [swift-users] raw buffer pointer load alignment

2017-11-09 Thread Kelvin Ma via swift-users
On Thu, Nov 9, 2017 at 10:37 AM, Johannes Weiß wrote: > Hi Kelvin, > > > On 9 Nov 2017, at 12:30 am, Kelvin Ma wrote: > > > > For context, the problem I’m trying to solve is efficiently parsing JPEG > chunks. This means reading each chunk of the JPEG from a file into a raw > buffer pointer, and

Re: [swift-users] raw buffer pointer load alignment

2017-11-09 Thread Kelvin Ma via swift-users
On Thu, Nov 9, 2017 at 10:37 AM, Johannes Weiß wrote: > Hi Kelvin, > > > On 9 Nov 2017, at 12:30 am, Kelvin Ma wrote: > > > > For context, the problem I’m trying to solve is efficiently parsing JPEG > chunks. This means reading each chunk of the JPEG from a file into a raw > buffer pointer, and

Re: [swift-users] raw buffer pointer load alignment

2017-11-09 Thread Johannes Weiß via swift-users
Hi Kelvin, > On 9 Nov 2017, at 12:30 am, Kelvin Ma wrote: > > For context, the problem I’m trying to solve is efficiently parsing JPEG > chunks. This means reading each chunk of the JPEG from a file into a raw > buffer pointer, and then parsing the chunk according to its expected layout. > Fo

Re: [swift-users] raw buffer pointer load alignment

2017-11-09 Thread Kelvin Ma via swift-users
For context, the problem I’m trying to solve is efficiently parsing JPEG chunks. This means reading each chunk of the JPEG from a file into a raw buffer pointer, and then parsing the chunk according to its expected layout. For example, a frame header chunk looks like this: 0 1

Re: [swift-users] raw buffer pointer load alignment

2017-11-08 Thread Johannes Weiß via swift-users
Hi Kelvin, > On 8 Nov 2017, at 5:40 pm, Kelvin Ma wrote: > > yikes there’s no less verbose way to do that? and if the type isn’t an > integer there’s no way to avoid the default initialization? Can this be done > with opaques or something? well, it's 5 lines for the generic case to rule all t

Re: [swift-users] raw buffer pointer load alignment

2017-11-08 Thread Kelvin Ma via swift-users
yikes there’s no less verbose way to do that? and if the type isn’t an integer there’s no way to avoid the default initialization? Can this be done with opaques or something? On Wed, Nov 8, 2017 at 7:04 PM, Johannes Weiß wrote: > Hi Kelvin, > > > On 8 Nov 2017, at 4:54 pm, Kelvin Ma via swift-us

Re: [swift-users] raw buffer pointer load alignment

2017-11-08 Thread Johannes Weiß via swift-users
Hi Kelvin, > On 8 Nov 2017, at 4:54 pm, Kelvin Ma via swift-users > wrote: > > According to the docs, the load(fromByteOffset:as:) method requires the > instance to be “properly aligned” Does that mean if I have raw data meant to > be interpreted as > > 0 1 2 3 4 5

[swift-users] raw buffer pointer load alignment

2017-11-08 Thread Kelvin Ma via swift-users
According to the docs , the load(fromByteOffset:as:) method requires the instance to be “properly aligned” Does that mean if I have raw data meant to be interpreted as 0 1 2 3 4 5 6 [