Skip site navigation (1) Skip section navigation (2)

Re: win32 random number generator

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Merlin Moncure" <merlin(dot)moncure(at)rcsonline(dot)com>
Cc: pgsql-hackers-win32(at)postgresql(dot)org
Subject: Re: win32 random number generator
Date: 2005-08-22 21:32:39
Message-ID: 21425.1124746359@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers-win32
"Merlin Moncure" <merlin(dot)moncure(at)rcsonline(dot)com> writes:
> Looks like this in lrand48(void):
> //return ((long) _rand48_seed[2] << 15) + ((long) _rand48_seed[1] > 1);

> is supposed to be this:
> return (long)((unsigned long) _rand48_seed[2] << 15) + ((unsigned long)
> _rand48_seed[1] >> 1);

Hmm, _rand48_seed is unsigned short, so casting to either long or
unsigned long should zero-extend, and then it doesn't matter whether
the shifts think it's signed or not.  In short, that shouldn't change
the behavior unless your compiler is broken.

			regards, tom lane

In response to

pgsql-hackers-win32 by date

Next:From: Claudio NatoliDate: 2005-08-23 05:13:42
Subject: Re: win32 random number generator
Previous:From: Merlin MoncureDate: 2005-08-22 21:21:54
Subject: Re: win32 random number generator

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group