diff options
Diffstat (limited to 'net/tipc/core.h')
-rw-r--r-- | net/tipc/core.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/net/tipc/core.h b/net/tipc/core.h index 53e8146..0fcf133 100644 --- a/net/tipc/core.h +++ b/net/tipc/core.h @@ -109,6 +109,26 @@ struct tipc_net { atomic_t subscription_count; }; +static inline u16 mod(u16 x) +{ + return x & 0xffffu; +} + +static inline int less_eq(u16 left, u16 right) +{ + return mod(right - left) < 32768u; +} + +static inline int more(u16 left, u16 right) +{ + return !less_eq(left, right); +} + +static inline int less(u16 left, u16 right) +{ + return less_eq(left, right) && (mod(right) != mod(left)); +} + #ifdef CONFIG_SYSCTL int tipc_register_sysctl(void); void tipc_unregister_sysctl(void); |