[Dart-dev] [5870] DART/branches/development/random_seq/random_seq_mod.f90: Fix problem with PGI 11.x and later.

nancy at ucar.edu nancy at ucar.edu
Tue Sep 18 15:05:24 MDT 2012


Revision: 5870
Author:   nancy
Date:     2012-09-18 15:05:24 -0600 (Tue, 18 Sep 2012)
Log Message:
-----------
Fix problem with PGI 11.x and later.  The inline binary constants in the 
code give the wrong values (changed default size of explicit constants and
they're now doing sign extension??). Assigning them to 'integer(i8), parameter' 
variables first gives the same results now as the intel compiler.  Tested with 
ifort and xlf on a couple different platforms and non-pgi results are identical 
to previous version.

Modified Paths:
--------------
    DART/branches/development/random_seq/random_seq_mod.f90

-------------- next part --------------
Modified: DART/branches/development/random_seq/random_seq_mod.f90
===================================================================
--- DART/branches/development/random_seq/random_seq_mod.f90	2012-09-18 20:19:53 UTC (rev 5869)
+++ DART/branches/development/random_seq/random_seq_mod.f90	2012-09-18 21:05:24 UTC (rev 5870)
@@ -48,7 +48,9 @@
 integer(i8), parameter :: UPPER_MASK  = z'80000000'
 integer(i8), parameter :: LOWER_MASK  = z'7FFFFFFF'
 integer(i8), parameter :: FULL32_MASK = z'FFFFFFFF'
-integer(i8), parameter :: magic       = z'9908b0df'
+integer(i8), parameter :: magic       = z'9908B0DF'
+integer(i8), parameter :: C1          = z'9D2C5680'
+integer(i8), parameter :: C2          = z'EFC60000'
 
 type random_seq_type
    private
@@ -283,8 +285,8 @@
 k = s%mt(s%mti)
 
 k = ieor(k, ishft(k, -11))
-k = ieor(k, iand(ishft(k, 7),  z'9d2c5680'))
-k = ieor(k, iand(ishft(k, 15), z'efc60000'))
+k = ieor(k, iand(ishft(k, 7),  C1))
+k = ieor(k, iand(ishft(k, 15), C2))
 k = ieor(k, ishft(k, -18))
 
 ! original c code:


More information about the Dart-dev mailing list