using memset

This commit is contained in:
David Parkhurst 2021-03-14 10:12:47 -06:00
parent 54b0d4d133
commit 1e0d410577
4 changed files with 6 additions and 6 deletions

View File

@ -1144,9 +1144,7 @@ protected:
int string_trim_right(char *str);
int string_trim_left(char *str);
static LDBLE under(LDBLE xval);
#ifdef SKIP
void zero_double(LDBLE * target, int n);
#endif
int get_input_errors(void);
int isamong(char c, const char *s_l);
Address Hash_multi(HashTable * Table, const char *Key);

View File

@ -903,6 +903,7 @@ cl1_space(int check, int l_n2d, int klm, int l_nklmd)
x_arg = &x_arg_v[0];
}
memset(x_arg_v.data(), 0, sizeof(double) * (size_t)l_n2d);
//zero_double(x_arg, l_n2d);
if (klm > res_arg_v.size())
{
@ -910,6 +911,7 @@ cl1_space(int check, int l_n2d, int klm, int l_nklmd)
res_arg = &res_arg_v[0];
}
memset(res_arg_v.data(), 0, sizeof(double) * (size_t)klm);
//zero_double(res_arg, klm);
if (l_nklmd > scratch_v.size())
{
@ -917,4 +919,5 @@ cl1_space(int check, int l_n2d, int klm, int l_nklmd)
scratch = &scratch_v[0];
}
memset(scratch_v.data(), 0, sizeof(double) * (size_t)l_nklmd);
//zero_double(scratch, l_nklmd);
}

View File

@ -1142,20 +1142,21 @@ ineq(int in_kode)
zero_v.resize((size_t)max_row_count);
zero = zero_v.data();
memset(zero, 0, (size_t)max_row_count * sizeof(double));
//zero_double(zero, max_row_count);
//space((void **) ((void *) &res), max_row_count, &res_max, sizeof(LDBLE));
//zero_double(res, max_row_count);
res_v.resize((size_t)max_row_count);
res = res_v.data();
memset(res, 0, (size_t)max_row_count * sizeof(double));
//zero_double(res, max_row_count);
//space((void **) ((void *) &delta1), max_column_count, &delta1_max,
// sizeof(LDBLE));
//zero_double(delta1, max_column_count);
delta1_v.resize((size_t)max_column_count);
delta1 = delta1_v.data();
memset(delta1, 0,(size_t)max_column_count * sizeof(double));
//zero_double(delta1, max_column_count);
/*
* Copy equations to optimize into ineq_array

View File

@ -1991,7 +1991,6 @@ string_pad(const char *str, int i)
}
return (str_ptr);
}
#ifdef SKIP
/* ---------------------------------------------------------------------- */
void Phreeqc::
zero_double(LDBLE * target, int n)
@ -2013,7 +2012,6 @@ zero_double(LDBLE * target, int n)
memcpy((void *) target, (void *) zeros, (size_t) (n * sizeof(LDBLE)));
return;
}
#endif
/* ---------------------------------------------------------------------- */
int Phreeqc::
get_input_errors()