Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20140921161244.GX21835@port70.net>
Date: Sun, 21 Sep 2014 18:12:45 +0200
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: [PATCH] fix a bug in the rand48 family of prng

* Alexander Monakov <amonakov@...ras.ru> [2014-09-21 20:01:08 +0400]:
> 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;
> }

ah yes signextension explains the problem


btw original mail said:

>        printf("%ld %ld %ld\n", lrand48(), lrand48(), lrand48());
> ...
> I expected to get the same sequence because...

the arg evaluation order is unspecified so
one should expect the same numbers but not
in the same order for this test

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.