Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31057
Modified Files: Tag: devel_0_37 m_memory.c Log Message: corrected to int type of pointer size
Index: m_memory.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/m_memory.c,v retrieving revision 1.1.1.2.2.4 retrieving revision 1.1.1.2.2.5 diff -C2 -d -r1.1.1.2.2.4 -r1.1.1.2.2.5 *** m_memory.c 9 Oct 2004 11:53:46 -0000 1.1.1.2.2.4 --- m_memory.c 10 Oct 2004 22:01:40 -0000 1.1.1.2.2.5 *************** *** 83,86 **** --- 83,88 ---- }
+ /* in the following size_t is assumed to have the same size as a pointer type !!! */ + /* T.Grill - get aligned memory */ void *getalignedbytes(size_t nbytes) *************** *** 90,94 **** */ void *vec = getbytes(nbytes+ (VECTORALIGNMENT/8-1)+sizeof(void *)); ! int alignment = ((unsigned long)vec+sizeof(void *))&(VECTORALIGNMENT/8-1); /* get alignment of first possible signal vector byte */ void *ret = (unsigned char *)vec+sizeof(void *)+(alignment == 0?0:VECTORALIGNMENT/8-alignment); /* calculate aligned pointer */ *(void **)((unsigned char *)ret-sizeof(void *)) = vec; /* save original memory location */ --- 92,96 ---- */ void *vec = getbytes(nbytes+ (VECTORALIGNMENT/8-1)+sizeof(void *)); ! t_int alignment = ((t_int)vec+sizeof(void *))&(VECTORALIGNMENT/8-1); /* get alignment of first possible signal vector byte */ void *ret = (unsigned char *)vec+sizeof(void *)+(alignment == 0?0:VECTORALIGNMENT/8-alignment); /* calculate aligned pointer */ *(void **)((unsigned char *)ret-sizeof(void *)) = vec; /* save original memory location */ *************** *** 108,112 **** void *ori = *(void **)((unsigned char *)ptr-sizeof(void *)); /* get original memory location */ void *vec = resizebytes(ori,oldsize+(VECTORALIGNMENT/8-1)+sizeof(void *),newsize+ (VECTORALIGNMENT/8-1)+sizeof(void *)); ! int alignment = ((unsigned long)vec+sizeof(void *))&(VECTORALIGNMENT/8-1); /* get alignment of first possible signal vector byte */ void *ret = (unsigned char *)vec+sizeof(void *)+(alignment == 0?0:VECTORALIGNMENT/8-alignment); /* calculate aligned pointer */ *(void **)((unsigned char *)ret-sizeof(void *)) = vec; /* save original memory location */ --- 110,114 ---- void *ori = *(void **)((unsigned char *)ptr-sizeof(void *)); /* get original memory location */ void *vec = resizebytes(ori,oldsize+(VECTORALIGNMENT/8-1)+sizeof(void *),newsize+ (VECTORALIGNMENT/8-1)+sizeof(void *)); ! t_int alignment = ((t_int)vec+sizeof(void *))&(VECTORALIGNMENT/8-1); /* get alignment of first possible signal vector byte */ void *ret = (unsigned char *)vec+sizeof(void *)+(alignment == 0?0:VECTORALIGNMENT/8-alignment); /* calculate aligned pointer */ *(void **)((unsigned char *)ret-sizeof(void *)) = vec; /* save original memory location */