Especially when timing is involved, multiplications tend to overflow 32 bit. It's better to use 64 bit variables during the calculation. ULL for constants ensures the correct width of intermediate results.
Signed-off-by: Ralf Ramsauer <[email protected]> --- inmates/lib/include/inmate_common.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/inmates/lib/include/inmate_common.h b/inmates/lib/include/inmate_common.h index d9f1df5f..c85f1383 100644 --- a/inmates/lib/include/inmate_common.h +++ b/inmates/lib/include/inmate_common.h @@ -42,9 +42,9 @@ #define NULL ((void *)0) -#define NS_PER_USEC 1000UL -#define NS_PER_MSEC 1000000UL -#define NS_PER_SEC 1000000000UL +#define NS_PER_USEC 1000ULL +#define NS_PER_MSEC 1000000ULL +#define NS_PER_SEC 1000000000ULL #ifndef __ASSEMBLY__ typedef s8 __s8; -- 2.22.0 -- You received this message because you are subscribed to the Google Groups "Jailhouse" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jailhouse-dev/20190612130332.6175-2-ralf.ramsauer%40oth-regensburg.de. For more options, visit https://groups.google.com/d/optout.
