- Timestamp:
- May 6, 2016, 3:06:29 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/applications/rosenfeld/src-par/mca_matrix_dist.c
r805 r821 14 14 #include <malloc.h> 15 15 16 #ifdef CLI17 16 #include "nrc_os_config.h" 18 17 #include "nrc.h" 19 #endif20 18 21 19 … … 61 59 } 62 60 61 #if TARGET_OS == GIETVM 62 // --------------------------------------------------------------------------- 63 uint32 ** remote_dist_ui32matrix(int i0, int i1, int j0, int j1, int x, int y) 64 // --------------------------------------------------------------------------- 65 { 66 int i; 67 int nrow = i1 - i0 + 1; 68 int ncol = j1 - j0 + 1; 69 uint32 ** m; 70 71 // allocate pointers to rows 72 m = (uint32 **) remote_malloc((nrow + 2) * sizeof(uint32 *), x, y); 73 if (!m) { 74 nrerror("allocation failure 1 in dist_ui32matrix()"); 75 } 76 m -= i0; 77 m += 1; 78 79 // allocate rows and set pointers to them 80 m[i0] = (uint32 *) remote_malloc((nrow * ncol + 1) * sizeof(uint32), x, y); 81 if (!m[i0]) { 82 nrerror("allocation failure 2 in dist_ui32matrix()"); 83 } 84 m[i0] -= j0; 85 86 for (i = i0 + 1; i <= i1; i++) { 87 m[i] = m[i - 1] + ncol; 88 } 89 90 // make borders to point to first and last lines 91 m[i0 - 1] = m[i0]; 92 m[i1 + 1] = m[i1]; 93 94 return m; 95 } 96 #endif 97 98 63 99 64 100 // ------------------------------------------------------------------- … … 66 102 // ------------------------------------------------------------------- 67 103 { 68 free( (FREE_ARG) (m[i0] + j0));69 free( (FREE_ARG) (m + i0 - 1));104 free(m[i0] + j0); 105 free(m + i0 - 1); 70 106 } 71 107
Note: See TracChangeset
for help on using the changeset viewer.