Ticket #270: stream.C.diff
File stream.C.diff, 1.4 KB (added by , 17 years ago) |
---|
-
stream.C
old new 97 97 double *a=(double *)malloc((N+OFFSET)*sizeof(double)); 98 98 double *b=(double *)malloc((N+OFFSET)*sizeof(double)); 99 99 double *c=(double *)malloc((N+OFFSET)*sizeof(double)); 100 double *at, bt, ct; 100 101 double quantum=checktick(); 101 102 int BytesPerWord; 102 103 register int j, k; … … 109 110 int i=0; 110 111 111 112 int check_cache=(cache_size==0); 113 if ( !a || !b || !c ) { 114 if ( a ) free(a); 115 if ( b ) free(b); 116 if ( c ) free(c); 117 return; 118 } 112 119 do { 113 120 N*=2; 114 a=(double *)realloc(a,(N+OFFSET)*sizeof(double)); 115 b=(double *)realloc(b,(N+OFFSET)*sizeof(double)); 116 c=(double *)realloc(c,(N+OFFSET)*sizeof(double)); 117 if ( !a || !b || !c ) return; 121 at=(double *)realloc(a,(N+OFFSET)*sizeof(double)); 122 bt=(double *)realloc(b,(N+OFFSET)*sizeof(double)); 123 ct=(double *)realloc(c,(N+OFFSET)*sizeof(double)); 124 /* exit if not enough memory reallocated */ 125 if ( at ) a = at; 126 if ( bt ) b = bt; 127 if ( ct ) c = ct; 128 if ( !at || !bt || !ct ) { 129 free(a); 130 free(b); 131 free(c); 132 return; 133 } 118 134 119 135 for (j=0; j<N; j++) { 120 136 a[j] = 1.0; … … 211 227 /* --- Check Results --- */ 212 228 checkSTREAMresults(a,b,c); 213 229 230 free(a); 231 free(b); 232 free(c); 214 233 } 215 234 216 235 # define M 20