mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: Ed Schouten <ed@nuxi.nl>
Cc: musl@lists.openwall.com
Subject: Re: jrand48(): missing cast to int32_t?
Date: Fri, 9 Dec 2016 18:05:13 +0100	[thread overview]
Message-ID: <20161209170512.GD16379@port70.net> (raw)
In-Reply-To: <CABh_MKm9w3uXtQx4zHS1mOLLFK7=RViX86+DNtYmrNFr_8C+qQ@mail.gmail.com>

* Ed Schouten <ed@nuxi.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


      reply	other threads:[~2016-12-09 17:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-09  6:16 Ed Schouten
2016-12-09 17:05 ` Szabolcs Nagy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161209170512.GD16379@port70.net \
    --to=nsz@port70.net \
    --cc=ed@nuxi.nl \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).