Oh, you are correct, I had forgotten about that. Thank you.
I wish I could go back and edit my prior email to correct my error. Restated: on 32 bit J, when the rank of the array is even an extra 4 bytes of padding are added before the data. Thanks again, -- Raul On Fri, Jun 21, 2013 at 1:31 AM, <[email protected]> wrote: > Hi Raul, > >>The underlying mechanism only makes sense when mixing structure >>elements which have different sizes. > > I fail to understand this, probably because I lost track of the > original context. (I.e., what is Greg trying to do?) > >>Still, if you can find any examples, it would be great to hear about them. > > In response to Greg's question "header size?", you pointed to > >> https://github.com/openj/core/blob/master/jtype.h#L41 says: >> typedef struct {I k,flag,m,t,c,n,r,s[1];}* A; > > Since Greg is somehow trying to cull J data from memory, I thought > it prudent to point out that the actual array data after the header > is not necessarily starting out directly after those SZ*I(7+r) bytes. > The relevant source is 30 lines down from the place you gave: > > https://github.com/openj/core/blob/master/jtype.h#L70-77 says: > > #if SY_64 > #define AKX(x) (SZI*(AH+AR(x))) > #define WP(t,n,r) (AH+ r > +(1&&t&LAST0)+((t&NAME?sizeof(NM):0)+(n)*bp(t)+SZI-1)/SZI) > #else > #define AKX(x) (SZI*(AH+AR(x)+!(1&AR(x)))) > #define WP(t,n,r) > (AH+(r+!(1&r))+(1&&t&LAST0)+((t&NAME?sizeof(NM):0)+(n)*bp(t)+SZI-1)/SZI) > #endif > /* make sure array values are double-word aligned */ > > This could be translated into: > > On 32bit systems, some extra padding after odd-length shape vectors, > pretty please. > > Showing an example is not that easy: > > 3!:1 and 3!:3 won't dump these bytes. Anyhow, Greg should aware that > they *are* there. (Or, when assembling arrays: is must be put there.) > > (On earlier J systems, the jtype.h did not discriminate on SY_64 but > on SY_DOUBLE. You could always set that just to be on the safe side.) > > Martin > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
