From e3cf0183114b7ceb4c161ceda8f081968bd8bda8 Mon Sep 17 00:00:00 2001 From: sjplimp <sjplimp@f3b2605a-c512-4ea7-a41b-209d697bcdaa> Date: Fri, 25 Mar 2011 20:01:49 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@5834 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/memory.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/memory.h b/src/memory.h index e523dd8a82..c90dff2d86 100644 --- a/src/memory.h +++ b/src/memory.h @@ -103,7 +103,7 @@ class Memory : protected Pointers { { bigint nbytes = sizeof(TYPE) * (nhi-nlo+1); array = (TYPE *) smalloc(nbytes,name); - array = array-nlo; + array -= nlo; return array; } @@ -118,7 +118,7 @@ class Memory : protected Pointers { template <typename TYPE> void destroy1d_offset(TYPE *array, int offset) { - if (array) sfree(array+offset); + if (array) sfree(&array[offset]); } /* ---------------------------------------------------------------------- @@ -302,7 +302,8 @@ class Memory : protected Pointers { { int n1 = n1hi - n1lo + 1; create(array,n1,n2,n3,name); - return array-n1lo; + array -= n1lo; + return array; } template <typename TYPE> @@ -317,7 +318,7 @@ class Memory : protected Pointers { template <typename TYPE> void destroy3d_offset(TYPE ***array, int offset) { - if (array) destroy(array+offset); + if (array) destroy(&array[offset]); } /* ---------------------------------------------------------------------- @@ -340,7 +341,8 @@ class Memory : protected Pointers { for (int i = 0; i < n1*n2; i++) array[0][i] -= n3lo; for (int i = 0; i < n1; i++) array[i] -= n2lo; - return array-n1lo; + array -= n1lo; + return array; } template <typename TYPE> @@ -360,7 +362,7 @@ class Memory : protected Pointers { if (array == NULL) return; sfree(&array[n1_offset][n2_offset][n3_offset]); sfree(&array[n1_offset][n2_offset]); - sfree(array + n1_offset); + sfree(&array[n1_offset]); } /* ---------------------------------------------------------------------- -- GitLab