[LON-CAPA-cvs] cvs: loncom(version_1_2_X) /lonnet/perl lonnet.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Sat, 06 Nov 2004 20:53:41 -0000
albertel Sat Nov 6 15:53:41 2004 EDT
Modified files: (Branch: version_1_2_X)
/loncom/lonnet/perl lonnet.pm
Log:
- making the random number generator act the same on a 64bit platform
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.523.2.9 loncom/lonnet/perl/lonnet.pm:1.523.2.10
--- loncom/lonnet/perl/lonnet.pm:1.523.2.9 Fri Nov 5 20:14:05 2004
+++ loncom/lonnet/perl/lonnet.pm Sat Nov 6 15:53:40 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.523.2.9 2004/11/06 01:14:05 albertel Exp $
+# $Id: lonnet.pm,v 1.523.2.10 2004/11/06 20:53:40 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -52,6 +52,7 @@
use Storable qw(lock_store lock_nstore lock_retrieve freeze thaw);
use Time::HiRes qw( gettimeofday tv_interval );
my $readit;
+my $_64bit=0;
=pod
@@ -4731,6 +4732,7 @@
$txt=~tr/U-Z/0-5/;
$txt=~tr/u-z/0-5/;
$txt=~s/\D//g;
+ if ($_64bit) { if ($total > 2**32) { return -1; } }
return int($txt);
}
@@ -4746,6 +4748,7 @@
my @txts=split(/(\d\d\d\d\d\d\d\d\d)/,$txt);
my $total;
foreach my $val (@txts) { $total+=$val; }
+ if ($_64bit) { if ($total > 2**32) { return -1; } }
return int($total);
}
@@ -4813,6 +4816,7 @@
my $num=$symbseed+$nameseed+$domainseed+$courseseed+$namechck+$symbchck;
#&Apache::lonxml::debug("$symbseed:$nameseed;$domainseed|$courseseed;$namechck:$symbchck");
#&Apache::lonxml::debug("rndseed :$num:$symb");
+ if ($_64bit) { $num=(($num<<32)>>32); }
return $num;
}
}
@@ -4833,6 +4837,8 @@
my $num2=$nameseed+$domainseed+$courseseed;
#&Apache::lonxml::debug("$symbseed:$nameseed;$domainseed|$courseseed;$namechck:$symbchck");
#&Apache::lonxml::debug("rndseed :$num:$symb");
+ if ($_64bit) { $num1=(($num1<<32)>>32); }
+ if ($_64bit) { $num2=(($num2<<32)>>32); }
return "$num1,$num2";
}
}
@@ -4855,6 +4861,8 @@
my $num2=$nameseed+$domainseed+$courseseed;
#&Apache::lonxml::debug("$symbseed:$nameseed;$domainseed|$courseseed;$namechck:$symbchck");
#&Apache::lonxml::debug("rndseed :$num:$symb");
+ if ($_64bit) { $num1=(($num1<<32)>>32); }
+ if ($_64bit) { $num2=(($num2<<32)>>32); }
return "$num1,$num2";
}
}
@@ -4877,6 +4885,8 @@
my $num2=$nameseed+$domainseed+$courseseed;
#&Apache::lonxml::debug("$symbseed:$nameseed;$domainseed|$courseseed;$namechck:$symbchck");
#&Apache::lonxml::debug("rndseed :$num:$symb");
+ if ($_64bit) { $num1=(($num1<<32)>>32); }
+ if ($_64bit) { $num2=(($num2<<32)>>32); }
return "$num1:$num2";
}
}
@@ -4894,6 +4904,8 @@
my $num2=$CODEseed+$courseseed+$symbchck;
#&Apache::lonxml::debug("$symbseed:$CODEchck|$CODEseed:$courseseed:$symbchck");
#&Apache::lonxml::debug("rndseed :$num1:$num2:$symb");
+ if ($_64bit) { $num1=(($num1<<32)>>32); }
+ if ($_64bit) { $num2=(($num2<<32)>>32); }
return "$num1:$num2";
}
}
@@ -5235,6 +5247,11 @@
}
BEGIN {
+ {
+ use integer;
+ my $test=(2**32)+1;
+ if ($test != 0) { $_64bit=1; }
+ }
# ----------------------------------- Read loncapa.conf and loncapa_apache.conf
unless ($readit) {
{