[PATCH i-g-t 1/3] lib/igt_core: Use unsigned constants for time conversion
Gustavo Sousa
gustavo.sousa at intel.com
Thu Aug 15 13:51:07 UTC 2024
Quoting Lucas De Marchi (2024-08-14 18:47:03-03:00)
>Time conversion is usually done with unsigned constant as it could
>otherwise give warnings on signed/unsigned comparisons.
>
>Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
>---
> lib/igt_core.h | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
>diff --git a/lib/igt_core.h b/lib/igt_core.h
>index 82f474c5f..c83bcbaba 100644
>--- a/lib/igt_core.h
>+++ b/lib/igt_core.h
>@@ -1505,10 +1505,10 @@ void igt_kmsg(const char *format, ...);
> #define le32_to_cpu(x) (x)
> #endif
>
>-#define MSEC_PER_SEC (1000)
>-#define USEC_PER_SEC (1000*MSEC_PER_SEC)
>-#define USEC_PER_DECISEC (100*MSEC_PER_SEC)
>-#define NSEC_PER_SEC (1000*USEC_PER_SEC)
>+#define MSEC_PER_SEC (1000U)
>+#define USEC_PER_SEC (1000u * MSEC_PER_SEC)
>+#define USEC_PER_DECISEC (100u * MSEC_PER_SEC)
>+#define NSEC_PER_SEC (1000u * USEC_PER_SEC)
With all suffixes using a common casing,
Reviewed-by: Gustavo Sousa <gustavo.sousa at intel.com>
>
> #define for_if(expr__) if (!(expr__)) {} else
>
>--
>2.43.0
>
More information about the igt-dev
mailing list