|
|
[PATCH 03/15] batman-adv: add biggest_unsigned_int(x) macro |
in case of dynamic type variable, it could be needed to compute at compile time its maximal value. This macro helps in doing that for unsigned integer types Signed-off-by: Antonio Quartulli <ordex@xxxxxxxxxxxxx> --- net/batman-adv/main.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h index a2b18d0..d9ef4ca 100644 --- a/net/batman-adv/main.h +++ b/net/batman-adv/main.h @@ -221,6 +221,9 @@ static inline bool has_timed_out(unsigned long timestamp, unsigned int timeout) /* Returns the smallest signed integer in two's complement with the sizeof x */ #define smallest_signed_int(x) (1u << (7u + 8u * (sizeof(x) - 1u))) +/* Returns the biggest unsigned integer with the sizeof x */ +#define biggest_unsigned_int(x) (~(x)0) + /* Checks if a sequence number x is a predecessor/successor of y. * they handle overflows/underflows and can correctly check for a * predecessor/successor unless the variable sequence number has grown by -- 1.7.9.4 -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
[Linux Kernel Discussion] [Ethernet Bridging] [Linux Wireless Networking] [Linux Bluetooth Networking] [Linux Networking Users] [VLAN] [Git] [IETF Annouce] [Linux Assembly] [Security] [Bugtraq] [Photo] [Singles Social Networking] [Yosemite Information] [MIPS Linux] [ARM Linux Kernel] [ARM Linux] [Linux Virtualization] [Linux Security] [Linux IDE] [Linux RAID] [Linux SCSI] [Free Dating]
![]() |
![]() |