core-lightning/overflows.h
Rusty Russell 670670f138 open-anchor-sig, many fixes for open-channel.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2015-05-29 10:51:16 +09:30

15 lines
317 B
C

#ifndef LIGHTNING_OVERFLOWS_H
#define LIGHTNING_OVERFLOWS_H
static inline bool add_overflows_size_t(uint64_t a, uint64_t b)
{
return (size_t)a != a || (size_t)b != b || (a + b) < (size_t)a;
}
static inline bool add_overflows_u64(uint64_t a, uint64_t b)
{
return (a + b) < a;
}
#endif /* LIGHTNING_OVERFLOWS_H */