8d742b2790cd5269a78dca3c108d5911e9f6ba98
2 * SPDX-License-Identifier: MIT
4 * Copyright 2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 #ifndef BABELTRACE_COMMON_SAFE_H
8 #define BABELTRACE_COMMON_SAFE_H
18 bool bt_safe_to_mul_int64(int64_t a
, int64_t b
)
20 if (a
== 0 || b
== 0) {
24 return a
< INT64_MAX
/ b
;
28 bool bt_safe_to_mul_uint64(uint64_t a
, uint64_t b
)
30 if (a
== 0 || b
== 0) {
34 return a
< UINT64_MAX
/ b
;
38 bool bt_safe_to_add_int64(int64_t a
, int64_t b
)
40 return a
<= INT64_MAX
- b
;
44 bool bt_safe_to_add_uint64(uint64_t a
, uint64_t b
)
46 return a
<= UINT64_MAX
- b
;
53 #endif /* BABELTRACE_COMMON_SAFE_H */
This page took 0.031496 seconds and 5 git commands to generate.