From 9d969476ec15eed0ab84d4f0a1963f2c0c697767 Mon Sep 17 00:00:00 2001 From: Steven Robertson Date: Tue, 3 May 2011 15:26:44 -0400 Subject: [PATCH] Be a little more particular about how mwc_11 is implemented --- cuburn/code/mwc.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cuburn/code/mwc.py b/cuburn/code/mwc.py index f0e60ce..507a49a 100644 --- a/cuburn/code/mwc.py +++ b/cuburn/code/mwc.py @@ -30,7 +30,12 @@ __device__ float mwc_next_01(mwc_st *st) { } __device__ float mwc_next_11(mwc_st *st) { - return ((int32_t) mwc_next(st)) * (1.0f / 2147483648.0f); + uint32_t val = mwc_next(st); + float ret; + asm("cvt.rn.f32.s32 %0, %1;\n\t" + "mul.f32 %0, %0, (1.0 / 2147483648.0);" + : "=f"(ret) : "r"(val)); + return ret; } """