From: Alexander Monakov <amonakov@ispras.ru>
To: musl@lists.openwall.com
Subject: Re: [PATCH] fix a bug in the rand48 family of prng
Date: Sun, 21 Sep 2014 20:01:08 +0400 (MSK) [thread overview]
Message-ID: <alpine.LNX.2.00.1409211958060.13391@monopod.intra.ispras.ru> (raw)
In-Reply-To: <alpine.LNX.2.00.1409211946260.13391@monopod.intra.ispras.ru>
On Sun, 21 Sep 2014, Alexander Monakov wrote:
> UB on shift shouldn't be a problem here; I think the issue is that
> "lc[0] | lc[1]<<16" gets sign-extended rather than zero-extended from 32 bit
> to 64 bit.
(sorry, sent previous email too soon)
example code:
unsigned short a[3];
long long foo()
{
return a[0] | a[1] << 16 | a[2]+0ull<<32;
}
long long bar()
{
return a[0] | a[1]+0u << 16 | a[2]+0ull<<32;
}
Incidentally I think a "+0u" should suffice as a fix rather that "+0ull".
Alexander
next prev parent reply other threads:[~2014-09-21 16:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-21 14:39 Jens Gustedt
2014-09-21 15:34 ` Szabolcs Nagy
2014-09-21 15:56 ` Alexander Monakov
2014-09-21 16:01 ` Alexander Monakov [this message]
2014-09-21 16:12 ` Szabolcs Nagy
2014-09-21 16:05 ` Jens Gustedt
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=alpine.LNX.2.00.1409211958060.13391@monopod.intra.ispras.ru \
--to=amonakov@ispras.ru \
--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).