swt2c / rpms / gdl

Forked from rpms/gdl 5 years ago
Clone
Blob Blame History Raw
diff -up gdl-0.9.4/src/gsl_matrix.cpp.gsl gdl-0.9.4/src/gsl_matrix.cpp
--- gdl-0.9.4/src/gsl_matrix.cpp.gsl	2013-09-20 10:10:02.000000000 -0600
+++ gdl-0.9.4/src/gsl_matrix.cpp	2013-10-03 13:50:41.089660703 -0600
@@ -41,10 +41,11 @@ namespace lib {
   const int szdbl=sizeof(DDouble);
   const int szflt=sizeof(DFloat);
   const int szlng=sizeof(DLong);
+  const int szlng64=sizeof(DLong64);
 
   void ludc_pro( EnvT* e)
   {
-    //  cout << szdbl << " " <<szflt << " " << szlng << endl;
+    //  cout << szdbl << " " <<szflt << " " << szlng << " " szlng64 << endl;
 
     SizeT nParam=e->NParam(1);
     //     if( nParam == 0)
@@ -120,9 +121,15 @@ namespace lib {
     dimension dim1(&n, (SizeT) 1);
     BaseGDL** p1D = &e->GetPar( 1);
     GDLDelete((*p1D));
-    *p1D = new DLongGDL(dim1, BaseGDL::NOZERO);
-    memcpy(&(*(DLongGDL*) *p1D)[0], p->data, 
-	   p0->Dim(0)*szlng);
+    if (sizeof(size_t) == szlng) {
+      *p1D = new DLongGDL(dim1, BaseGDL::NOZERO);
+      memcpy(&(*(DLongGDL*) *p1D)[0], p->data, 
+	p0->Dim(0)*szlng);
+    } else {
+      *p1D = new DLong64GDL(dim1, BaseGDL::NOZERO);
+      memcpy(&(*(DLong64GDL*) *p1D)[0], p->data, 
+	p0->Dim(0)*szlng64);
+    }
     
 //     gsl_matrix_free(mat);
 //     gsl_permutation_free(p);
@@ -189,10 +196,15 @@ namespace lib {
     GDLGuard<gsl_matrix> g1(mat,gsl_matrix_free);
     memcpy(mat->data, &(*p0D)[0], nEl*szdbl);
 
-    DLongGDL* p1L =e->GetParAs<DLongGDL>(1);
     gsl_permutation *p = gsl_permutation_alloc (nEl1);
     GDLGuard<gsl_permutation> g2(p,gsl_permutation_free);
-    memcpy(p->data, &(*p1L)[0], nEl1*szlng);
+    if (sizeof(size_t) == szlng) {
+      DLongGDL* p1L =e->GetParAs<DLongGDL>(1);
+      memcpy(p->data, &(*p1L)[0], nEl1*szlng);
+    } else {
+      DLong64GDL* p1L =e->GetParAs<DLong64GDL>(1);
+      memcpy(p->data, &(*p1L)[0], nEl1*szlng64);
+    }
       
     DDoubleGDL *p2D = e->GetParAs<DDoubleGDL>(2);
     gsl_vector *b = gsl_vector_alloc(nEl2);
@@ -222,7 +234,7 @@ namespace lib {
     DDoubleGDL* res = new DDoubleGDL( p2->Dim(), BaseGDL::NOZERO);
     memcpy(&(*res)[0], x->data, nEl1*szdbl);
 	
-//     gsl_matrix_free(mat);
+//     gsl_matrix_free(mat);Parameter
 //     gsl_vector_free(x);
 //     gsl_permutation_free(p);
 //     b ???