random.cc (4045:43eb54e807d1) random.cc (4394:dbaff14bb974)
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 15 unchanged lines hidden (view full) ---

24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * Authors: Nathan Binkert
29 * Ali Saidi
30 */
31
1/*
2 * Copyright (c) 2003-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 15 unchanged lines hidden (view full) ---

24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * Authors: Nathan Binkert
29 * Ali Saidi
30 */
31
32#if defined(__sun)
33#include <ieeefp.h>
34#endif
35#ifdef __SUNPRO_CC
36#include <stdlib.h>
37#include <math.h>
38#endif
39
40#include <cstdlib>
41#include <cmath>
42

--- 13 unchanged lines hidden (view full) ---

56 return drand48();
57}
58
59double
60m5round(double r)
61{
62#if defined(__sun)
63 double val;
32#ifdef __SUNPRO_CC
33#include <stdlib.h>
34#include <math.h>
35#endif
36
37#include <cstdlib>
38#include <cmath>
39

--- 13 unchanged lines hidden (view full) ---

53 return drand48();
54}
55
56double
57m5round(double r)
58{
59#if defined(__sun)
60 double val;
64 fp_rnd oldrnd = fpsetround(FP_RN);
61 int oldrnd = m5_fegetround();
62 m5_fesetround(M5_FP_TONEAREST);
65 val = rint(r);
63 val = rint(r);
66 fpsetround(oldrnd);
64 m5_fesetround(oldrnd);
67 return val;
68#else
69 return round(r);
70#endif
71}
72
73int64_t
74getUniform(int64_t min, int64_t max)

--- 15 unchanged lines hidden ---
65 return val;
66#else
67 return round(r);
68#endif
69}
70
71int64_t
72getUniform(int64_t min, int64_t max)

--- 15 unchanged lines hidden ---