From: "Sharma, Swati2" <swati2.sharma@intel.com>
To: Jani Nikula <jani.nikula@intel.com>, <igt-dev@lists.freedesktop.org>
Subject: Re: [PATCH i-g-t 2/5] lib/rand: move static inlines to proper functions
Date: Fri, 19 Jun 2026 00:25:42 +0530 [thread overview]
Message-ID: <210af144-af2e-4752-8645-031b8a3c2886@intel.com> (raw)
In-Reply-To: <40a88ff11484791be04e69d648a0a09aa218f9f2.1781791747.git.jani.nikula@intel.com>
Hi Jani
On 18-06-2026 07:39 pm, Jani Nikula wrote:
> Hide the implementation details. Gut feeling says this also allows the
> compiler to do better optimizations within the compilation unit.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Patch LGTM
Reviewed-by: Swati Sharma <swati2.sharma@intel.com>
> ---
> lib/igt_rand.c | 13 +++++++++++++
> lib/igt_rand.h | 13 ++-----------
> 2 files changed, 15 insertions(+), 11 deletions(-)
>
> diff --git a/lib/igt_rand.c b/lib/igt_rand.c
> index 16a6ba9b0c65..b2856d000450 100644
> --- a/lib/igt_rand.c
> +++ b/lib/igt_rand.c
> @@ -35,3 +35,16 @@ uint32_t hars_petruska_f54_1_random_unsafe(void)
> {
> return hars_petruska_f54_1_random(&global);
> }
> +
> +void hars_petruska_f54_1_random_perturb(uint32_t xor)
> +{
> + uint32_t seed = hars_petruska_f54_1_random_seed(0) ^ xor;
> + hars_petruska_f54_1_random_seed(seed);
> + hars_petruska_f54_1_random_seed(hars_petruska_f54_1_random_unsafe());
> +}
> +
> +/* Returns: pseudo-random number in interval [0, ep_ro) */
> +uint32_t hars_petruska_f54_1_random_unsafe_max(uint32_t ep_ro)
> +{
> + return ((uint64_t)hars_petruska_f54_1_random_unsafe() * ep_ro) >> 32;
> +}
> diff --git a/lib/igt_rand.h b/lib/igt_rand.h
> index 0015680461c1..d89803bb020b 100644
> --- a/lib/igt_rand.h
> +++ b/lib/igt_rand.h
> @@ -32,17 +32,8 @@ uint64_t hars_petruska_f54_1_random64(uint32_t *s);
> uint32_t hars_petruska_f54_1_random_seed(uint32_t seed);
> uint32_t hars_petruska_f54_1_random_unsafe(void);
>
> -static inline void hars_petruska_f54_1_random_perturb(uint32_t xor)
> -{
> - uint32_t seed = hars_petruska_f54_1_random_seed(0) ^ xor;
> - hars_petruska_f54_1_random_seed(seed);
> - hars_petruska_f54_1_random_seed(hars_petruska_f54_1_random_unsafe());
> -}
> +void hars_petruska_f54_1_random_perturb(uint32_t xor);
>
> -/* Returns: pseudo-random number in interval [0, ep_ro) */
> -static inline uint32_t hars_petruska_f54_1_random_unsafe_max(uint32_t ep_ro)
> -{
> - return ((uint64_t)hars_petruska_f54_1_random_unsafe() * ep_ro) >> 32;
> -}
> +uint32_t hars_petruska_f54_1_random_unsafe_max(uint32_t ep_ro);
>
> #endif /* IGT_RAND_H */
next prev parent reply other threads:[~2026-06-18 18:56 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-18 14:09 [PATCH i-g-t 0/5] igt: cleanups to random functions Jani Nikula
2026-06-18 14:09 ` [PATCH i-g-t 1/5] lib/kms: simplify igt_random_crtc() Jani Nikula
2026-06-18 18:54 ` Sharma, Swati2
2026-06-18 14:09 ` [PATCH i-g-t 2/5] lib/rand: move static inlines to proper functions Jani Nikula
2026-06-18 18:55 ` Sharma, Swati2 [this message]
2026-06-18 14:09 ` [PATCH i-g-t 3/5] benchmarks/gem_exec_reloc: use hars_petruska_f54_1_random() from lib/rand Jani Nikula
2026-06-18 18:56 ` Sharma, Swati2
2026-06-18 14:09 ` [PATCH i-g-t 4/5] benchmarks/gem_exec_trace: " Jani Nikula
2026-06-18 18:56 ` Sharma, Swati2
2026-06-18 14:09 ` [PATCH i-g-t 5/5] tests/gem_exec_lut_handle: " Jani Nikula
2026-06-18 18:56 ` Sharma, Swati2
2026-06-18 17:49 ` ✓ Xe.CI.BAT: success for igt: cleanups to random functions Patchwork
2026-06-18 18:30 ` ✓ i915.CI.BAT: " Patchwork
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=210af144-af2e-4752-8645-031b8a3c2886@intel.com \
--to=swati2.sharma@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=jani.nikula@intel.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.