help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: with 64-bit arrays: A, M, S out of order in MLTMOD - ABORT!


From: Muhali
Subject: Re: with 64-bit arrays: A, M, S out of order in MLTMOD - ABORT!
Date: Thu, 3 Jun 2010 14:17:53 -0700 (PDT)

it works if the int32_t type is replaced by octave_idx_type in oct-rand.cc
(see patch below).

--------------------------
--- octave/liboctave/oct-rand.cc        2010-06-03 13:40:46.690772152 -0700
+++ /tmp/oct-rand.cc    2010-06-03 13:35:55.818350446 -0700
@@ -60,16 +60,16 @@
   F77_FUNC (dgengam, DGENGAM) (const double&, const double&, double&);
 
   F77_RET_T
-  F77_FUNC (setall, SETALL) (const int32_t&, const int32_t&);
+  F77_FUNC (setall, SETALL) (const octave_idx_type&, const
octave_idx_type&);
 
   F77_RET_T
-  F77_FUNC (getsd, GETSD) (int32_t&, int32_t&);
+  F77_FUNC (getsd, GETSD) (octave_idx_type&, octave_idx_type&);
 
   F77_RET_T
-  F77_FUNC (setsd, SETSD) (const int32_t&, const int32_t&);
+  F77_FUNC (setsd, SETSD) (const octave_idx_type&, const octave_idx_type&);
 
   F77_RET_T
-  F77_FUNC (setcgn, SETCGN) (const int32_t&);
+  F77_FUNC (setcgn, SETCGN) (const octave_idx_type&);
 }
 
 octave_rand *octave_rand::instance = 0;
@@ -105,7 +105,7 @@
 double
 octave_rand::do_seed (void)
 {
-  union d2i { double d; int32_t i[2]; };
+  union d2i { double d; octave_idx_type i[2]; };
   union d2i u;
     
   oct_mach_info::float_format ff = oct_mach_info::native_float_format ();
@@ -123,8 +123,8 @@
   return u.d;
 }
 
-static int32_t
-force_to_fit_range (int32_t i, int32_t lo, int32_t hi)
+static octave_idx_type
+force_to_fit_range (octave_idx_type i, octave_idx_type lo, octave_idx_type
hi)
 {
   assert (hi > lo && lo >= 0 && hi > lo);
 
@@ -144,7 +144,7 @@
   use_old_generators = true;
 
   int i0, i1;
-  union d2i { double d; int32_t i[2]; };
+  union d2i { double d; octave_idx_type i[2]; };
   union d2i u;
   u.d = s;
 
@@ -451,8 +451,8 @@
   int minute = tm.min() + 1;
   int second = tm.sec() + 1;
 
-  int32_t s0 = tm.mday() * hour * minute * second;
-  int32_t s1 = hour * minute * second;
+  octave_idx_type s0 = tm.mday() * hour * minute * second;
+  octave_idx_type s1 = hour * minute * second;
 
   s0 = force_to_fit_range (s0, 1, 2147483563);
   s1 = force_to_fit_range (s1, 1, 2147483399);

-- 
View this message in context: 
http://octave.1599824.n4.nabble.com/with-64-bit-arrays-A-M-S-out-of-order-in-MLTMOD-ABORT-tp2240897p2242371.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]