Newsgroups: sci.math, comp.lang.c, comp.lang.fortran
From: Ben Bacarisse <ben.use...@bsb.me.uk>
Date: Mon, 06 Sep 2010 15:41:07 +0100
Local: Mon, Sep 6 2010 10:41 am
Subject: Re: Implementing the KISS4691 RNG
Ian Collins <ian-n...@hotmail.com> writes: Just as a side note... To increase portability one could use > On 09/ 6/10 09:57 PM, robin wrote: >> "Ian Collins"<ian-n...@hotmail.com> wrote in message news:8ejqjaFhq7U6@mid.individual.net... >> |> It's for 32 bit words. >> You would need to truncate to 32 bits immediately after each right shift. > As I said, use fixed size types. Otherwise the code won't work in 64 > #include <stdint.h> > uint32_t MWC(void) > j=(j<4690)? j+1:0; > if(t<c) { uint_fast32_t and mask the result. The mask will be optimised away (by any decent compiler) when uint_fast32_t is actually a 32-bit type. For maximum portability C90 has to be used, and there the simplest -- You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||