Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
CLHEP
CLHEP
Commits
31505110
Commit
31505110
authored
Feb 03, 2012
by
Lynn Garren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
address sr #125918 and bug #86228
parent
0208f3b4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
4 deletions
+35
-4
ChangeLog
ChangeLog
+3
-0
Random/ChangeLog
Random/ChangeLog
+4
-0
Random/src/Ranlux64Engine.cc
Random/src/Ranlux64Engine.cc
+26
-2
Random/test/testRandDists.cc
Random/test/testRandDists.cc
+2
-2
No files found.
ChangeLog
View file @
31505110
2012-02-03 Lynn Garren <garren@fnal.gov>
* Random/src/Ranlux64Engine.cc: use a template to get rid of the warnings
2012-02-02 Lynn Garren <garren@fnal.gov>
...
...
Random/ChangeLog
View file @
31505110
2012-02-03 Lynn Garren <garren@fnal.gov>
* src/Ranlux64Engine.cc: use a template to get rid of the warnings
2012-02-01 Lynn Garren <garren@fnal.gov>
* change the names of internal variables so -Wshadow does not complain
...
...
Random/src/Ranlux64Engine.cc
View file @
31505110
...
...
@@ -74,6 +74,28 @@ int Ranlux64Engine::numEngines = 0;
// Maximum index into the seed table
int
Ranlux64Engine
::
maxIndex
=
215
;
namespace
detail
{
template
<
std
::
size_t
n
,
bool
=
n
<
std
::
size_t
(
std
::
numeric_limits
<
unsigned
long
>
::
digits
)
>
struct
do_right_shift
;
template
<
std
::
size_t
n
>
struct
do_right_shift
<
n
,
true
>
{
unsigned
long
operator
()(
unsigned
long
value
)
{
return
value
>>
n
;
}
};
template
<
std
::
size_t
n
>
struct
do_right_shift
<
n
,
false
>
{
unsigned
long
operator
()(
unsigned
long
)
{
return
0ul
;
}
};
template
<
std
::
size_t
nbits
>
unsigned
long
rshift
(
unsigned
long
value
)
{
return
do_right_shift
<
nbits
>
()(
value
);
}
}
// namespace detail
std
::
string
Ranlux64Engine
::
name
()
const
{
return
"Ranlux64Engine"
;}
Ranlux64Engine
::
Ranlux64Engine
()
...
...
@@ -396,8 +418,10 @@ void Ranlux64Engine::setSeed(long seed, int lux) {
// are we on a 64bit machine?
if
(
sizeof
(
long
)
>=
8
)
{
long
topbits1
,
topbits2
;
topbits1
=
(
seed
>>
32
)
&
0xffff
;
topbits2
=
(
seed
>>
48
)
&
0xffff
;
//topbits1 = ( seed >> 32) & 0xffff ;
//topbits2 = ( seed >> 48) & 0xffff ;
topbits1
=
detail
::
rshift
<
32
>
(
seed
)
&
0xffff
;
topbits2
=
detail
::
rshift
<
48
>
(
seed
)
&
0xffff
;
init_table
[
0
]
^=
topbits1
;
init_table
[
2
]
^=
topbits2
;
//std::cout << " init_table[0] " << init_table[0] << " from " << topbits1 << std::endl;
...
...
Random/test/testRandDists.cc
View file @
31505110
...
...
@@ -1125,7 +1125,7 @@ int testRandGeneral() {
{
// Open block for testing type 1 - step function pdf
RandGeneral
dist
(
eng
,
aProbFunc
,
nBins
,
1
);
delete
aProbFunc
;
delete
[]
aProbFunc
;
double
*
garbage
=
new
double
[
nBins
];
// We wish to verify that deleting the pdf
...
...
@@ -1143,7 +1143,7 @@ int testRandGeneral() {
good
=
gaussianTest
(
dist
,
mu
,
sigma
,
nNumbers
);
delete
garbage
;
delete
[]
garbage
;
}
// Close block for testing type 1 - step function pdf
// dist goes out of scope but eng is supposed to stick around;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment