Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 21 Sep 2014 20:01:08 +0400 (MSK)
From: Alexander Monakov <>
Subject: Re: [PATCH] fix a bug in the rand48 family of prng

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".


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.