chiark / gitweb /
fixed bug in set/get xtol_abs, thanks to David Rivest-Hénault for the bug report
authorstevenj <stevenj@alum.mit.edu>
Thu, 19 Aug 2010 07:36:43 +0000 (03:36 -0400)
committerstevenj <stevenj@alum.mit.edu>
Thu, 19 Aug 2010 07:36:43 +0000 (03:36 -0400)
darcs-hash:20100819073643-c8de0-80e9c5691ef76d73f33255b0b615dced6374467a.gz

api/options.c

index 9dd9bb46d56006b99a978b7eb6c57941b705bf30..0c86418da1d236336ceb4a04190fc695d9484811 100644 (file)
@@ -507,7 +507,7 @@ nlopt_result
 NLOPT_STDCALL nlopt_set_xtol_abs(nlopt_opt opt, const double *xtol_abs)
 {
      if (opt) {
-         memcpy(opt->xtol_abs, xtol_abs, opt->n & sizeof(double));
+         memcpy(opt->xtol_abs, xtol_abs, opt->n * sizeof(double));
          return NLOPT_SUCCESS;
      }
      return NLOPT_INVALID_ARGS;
@@ -528,7 +528,7 @@ NLOPT_STDCALL nlopt_set_xtol_abs1(nlopt_opt opt, const double xtol_abs)
 nlopt_result
 NLOPT_STDCALL nlopt_get_xtol_abs(const nlopt_opt opt, double *xtol_abs)
 {
-     memcpy(xtol_abs, opt->xtol_abs, opt->n & sizeof(double));
+     memcpy(xtol_abs, opt->xtol_abs, opt->n * sizeof(double));
      return NLOPT_SUCCESS;
 }