> On 2010-08-13 15:57:40, Steve Reinhardt wrote:
> > Is this right? Seems like genrand(1) and genrand(2) will now do the same
> > thing. Should we be calling ceilLog2(max+1) instead?
> >
>
> Ali Saidi wrote:
> You're right Steve, it still fails on powers of two. I tested from 0 to
> 10 and it was correct with ceilLog2(max) + 1, so I'll go with that.
>
> Nathan Binkert wrote:
> I'm happy to review an updated diff if you like.
It just turned into:
if (max == 0)
return 0;
int log = ceilLog2(max) + 1;
I tested it for max = 0 to max = 10 and it produced the appropriate results
each time. The previous change would fail on powers of two.
- Ali
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviews.m5sim.org/r/157/#review172
-----------------------------------------------------------
On 2010-08-13 09:39:05, Ali Saidi wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviews.m5sim.org/r/157/
> -----------------------------------------------------------
>
> (Updated 2010-08-13 09:39:05)
>
>
> Review request for Default.
>
>
> Summary
> -------
>
> BASE: Fix genrand to generate both 0s and 1s when max equals one.
> previously was only generating 0s.
>
>
> Diffs
> -----
>
> src/base/random.cc 3c48b2b3cb83
>
> Diff: http://reviews.m5sim.org/r/157/diff
>
>
> Testing
> -------
>
>
> Thanks,
>
> Ali
>
>
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev