Print this page
9936 atomic ops in syscall_mstate() induce significant overhead
9942 zone secflags are not initialized correctly
*** 371,380 ****
--- 371,393 ----
#if !defined(ARRAY_SIZE)
#define ARRAY_SIZE(x) (sizeof (x) / sizeof (x[0]))
#endif
+ /*
+ * Add a value to a uint64_t that saturates at UINT64_MAX instead of wrapping
+ * around.
+ */
+ #define UINT64_OVERFLOW_ADD(val, add) \
+ ((val) > ((val) + (add)) ? (UINT64_MAX) : ((val) + (add)))
+
+ /*
+ * Convert to an int64, saturating at INT64_MAX.
+ */
+ #define UINT64_OVERFLOW_TO_INT64(uval) \
+ (((uval) > INT64_MAX) ? INT64_MAX : (int64_t)(uval))
+
#ifdef __cplusplus
}
#endif
#endif /* _SYS_SYSMACROS_H */