On 12.06.19 15:03, Ralf Ramsauer wrote:
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;
Did you check if this is side-effect free for ARMv7 inmates?
Jan
--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
--
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/5f477941-2c06-0a37-9397-03aeec6c62b9%40siemens.com.
For more options, visit https://groups.google.com/d/optout.