From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 053064C1CE for ; Thu, 6 Feb 2025 02:08:47 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 19CF768B9E7; Thu, 6 Feb 2025 04:08:44 +0200 (EET) Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8998068B992 for ; Thu, 6 Feb 2025 04:08:38 +0200 (EET) Received: by mail.gandi.net (Postfix) with ESMTPSA id E519E1F764 for ; Thu, 6 Feb 2025 02:08:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1738807718; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=p15JUeNoAQY+go/lFRmfgDAFRBHi8yR2NxJKaUZvP5k=; b=AEKsVSQO4y8lVj66weBinsvS5pT82kyPGUCYIQsrwruEllKOg6Ad3VeMiyTtMHRJXvq5m6 oKftNzYjCvPwZUVgoQ7oRBmlcZYa1qahShul4N10RoYDgD71bK9SP0gFsw75dTjstCWgqV HD8jXu47pw/NuXJqUWcR0Aib2zHIMwwC9NGPiyOLRcEWrOmSX41r3yTTm+2h5Z56iJP8gh RcGYW8YVl491f5/W1w8Qdj+N7JA28yCAp41xUmTDT764FlVlvACJZZlnqAfTweoN/4rMOw 7CKbgH1mCEf6cQIvMFpxWDARHYr8oi5drMpBbmoPhIWpa9skAXtJ3GFV0BFfrg== Date: Thu, 6 Feb 2025 03:08:36 +0100 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20250206020836.GK4991@pb2> References: <20250205221813.4110398-1-martin@martin.st> MIME-Version: 1.0 In-Reply-To: <20250205221813.4110398-1-martin@martin.st> X-GND-State: clean X-GND-Score: -70 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddvhedufecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrhhlucfvnfffucdlfedtmdenucfjughrpeffhffvuffkfhggtggujgesghdtreertddtudenucfhrhhomhepofhitghhrggvlhcupfhivgguvghrmhgrhigvrhcuoehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgeqnecuggftrfgrthhtvghrnhepudetvdfhudeuudegudefgfehhfevvdfggfffkefhvdfgvdetffdtjeekheetfeehnecukfhppeeguddrieeirdeijedruddufeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeeguddrieeirdeijedruddufedphhgvlhhopehlohgtrghlhhhoshhtpdhmrghilhhfrhhomhepmhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtpdhnsggprhgtphhtthhopedupdhrtghpthhtohepfhhfmhhpvghgqdguvghvvghlsehffhhmphgvghdrohhrgh X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH v2 1/2] random_seed: Reorder if clauses for gathering entropy X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: multipart/mixed; boundary="===============1023898175811357633==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============1023898175811357633== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="H6MWDjLGRMUwhQhm" Content-Disposition: inline --H6MWDjLGRMUwhQhm Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi On Thu, Feb 06, 2025 at 12:18:08AM +0200, Martin Storsj=F6 wrote: > Make it easier to add more cases. >=20 > This should be a pure refactoring, with no functional changes. > --- > libavutil/random_seed.c | 19 +++++++++++-------- > 1 file changed, 11 insertions(+), 8 deletions(-) >=20 > diff --git a/libavutil/random_seed.c b/libavutil/random_seed.c > index 8a4e4f1fc0..ca084b40da 100644 > --- a/libavutil/random_seed.c > +++ b/libavutil/random_seed.c > @@ -98,17 +98,20 @@ static uint32_t get_generic_seed(void) > =20 > for (;;) { > clock_t t =3D clock(); > - if (last_t + 2*last_td + (CLOCKS_PER_SEC > 1000) >=3D t) { > - last_td =3D t - last_t; > - buffer[i & 511] =3D 1664525*buffer[i & 511] + 1013904223 + (= last_td % 3294638521U); > + int incremented_i =3D 0; > + int cur_td =3D t - last_t; > + if (last_t + 2*last_td + (CLOCKS_PER_SEC > 1000) < t) { > + buffer[++i & 511] +=3D cur_td % 3294638521U; > + incremented_i =3D 1; > } else { > - last_td =3D t - last_t; > - buffer[++i & 511] +=3D last_td % 3294638521U; > - if ((t - init_t) >=3D CLOCKS_PER_SEC>>5) > - if (last_i && i - last_i > 4 || i - last_i > 64 || TEST = && i - last_i > 8) > - break; > + buffer[i & 511] =3D 1664525*buffer[i & 511] + 1013904223 + (= cur_td % 3294638521U); > + } > + if (incremented_i && (t - init_t) >=3D CLOCKS_PER_SEC>>5) { > + if (last_i && i - last_i > 4 || i - last_i > 64 || TEST && i= - last_i > 8) > + break; > } > last_t =3D t; > + last_td =3D cur_td; > if (!init_t) > init_t =3D t; > } sure, if you prefer / if it makes chanegs easier thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I am the wisest man alive, for I know one thing, and that is that I know nothing. -- Socrates --H6MWDjLGRMUwhQhm Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZ6QZnQAKCRBhHseHBAsP qxidAJ9HJVxpripzWc6lTS7DGTA8qdJgWQCfdZlIYtzsoc5bdEpWVD6vE6jSWfU= =7loe -----END PGP SIGNATURE----- --H6MWDjLGRMUwhQhm-- --===============1023898175811357633== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". --===============1023898175811357633==--