|
|
Message-ID: <20161209170512.GD16379@port70.net>
Date: Fri, 9 Dec 2016 18:05:13 +0100
From: Szabolcs Nagy <nsz@...t70.net>
To: Ed Schouten <ed@...i.nl>
Cc: musl@...ts.openwall.com
Subject: Re: jrand48(): missing cast to int32_t?
* Ed Schouten <ed@...i.nl> [2016-12-09 07:16:42 +0100]:
> According to POSIX, jrand48() is supposed to return a value between
> [-2^31, 2^31). Musl's version of jrand48() is implemented as follows:
>
> long jrand48(unsigned short s[3])
> {
> return __rand48_step(s, __seed48+3) >> 16;
> }
nice catch, note that posix does not guarantee that
long can represent -2^31 so this requirement is not
possible to implement portably (indeed your proposed
cast has implementation defined effect, but in musl
we already rely on it to work as expected).
i submitted a posix bug report against limits.h
http://austingroupbugs.net/view.php?id=1108
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.