Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Fri, 9 Dec 2016 18:05:13 +0100
From: Szabolcs Nagy <>
To: Ed Schouten <>
Subject: Re: jrand48(): missing cast to int32_t?

* Ed Schouten <> [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

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.