Skip to content
Snippets Groups Projects
Commit e3cf0183 authored by sjplimp's avatar sjplimp
Browse files

git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@5834 f3b2605a-c512-4ea7-a41b-209d697bcdaa
parent 50b8413f
No related branches found
No related tags found
No related merge requests found
...@@ -103,7 +103,7 @@ class Memory : protected Pointers { ...@@ -103,7 +103,7 @@ class Memory : protected Pointers {
{ {
bigint nbytes = sizeof(TYPE) * (nhi-nlo+1); bigint nbytes = sizeof(TYPE) * (nhi-nlo+1);
array = (TYPE *) smalloc(nbytes,name); array = (TYPE *) smalloc(nbytes,name);
array = array-nlo; array -= nlo;
return array; return array;
} }
...@@ -118,7 +118,7 @@ class Memory : protected Pointers { ...@@ -118,7 +118,7 @@ class Memory : protected Pointers {
template <typename TYPE> template <typename TYPE>
void destroy1d_offset(TYPE *array, int offset) 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 { ...@@ -302,7 +302,8 @@ class Memory : protected Pointers {
{ {
int n1 = n1hi - n1lo + 1; int n1 = n1hi - n1lo + 1;
create(array,n1,n2,n3,name); create(array,n1,n2,n3,name);
return array-n1lo; array -= n1lo;
return array;
} }
template <typename TYPE> template <typename TYPE>
...@@ -317,7 +318,7 @@ class Memory : protected Pointers { ...@@ -317,7 +318,7 @@ class Memory : protected Pointers {
template <typename TYPE> template <typename TYPE>
void destroy3d_offset(TYPE ***array, int offset) 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 { ...@@ -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*n2; i++) array[0][i] -= n3lo;
for (int i = 0; i < n1; i++) array[i] -= n2lo; for (int i = 0; i < n1; i++) array[i] -= n2lo;
return array-n1lo; array -= n1lo;
return array;
} }
template <typename TYPE> template <typename TYPE>
...@@ -360,7 +362,7 @@ class Memory : protected Pointers { ...@@ -360,7 +362,7 @@ class Memory : protected Pointers {
if (array == NULL) return; if (array == NULL) return;
sfree(&array[n1_offset][n2_offset][n3_offset]); sfree(&array[n1_offset][n2_offset][n3_offset]);
sfree(&array[n1_offset][n2_offset]); sfree(&array[n1_offset][n2_offset]);
sfree(array + n1_offset); sfree(&array[n1_offset]);
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment