> From: Andre Muezerie [mailto:andre...@linux.microsoft.com] > Sent: Thursday, 2 January 2025 23.33 > > __builtin_add_overflow is gcc specific. There's a need for a portable > version that can also be used with other compilers. > > This patch introduces __rte_add_overflow_u8, __rte_add_overflow_u16 > and __rte_add_overflow_u32.
Instead of the proposed three type-specific macros, add one generic rte_add_overflow(a, b, res) macro, like rte_bit_test() [1] using "_Generic". [1]: https://elixir.bootlin.com/dpdk/v24.11.1/source/lib/eal/include/rte_bitops.h#L130 You may still need the type-specific macros as internal helpers for the MSVC implementation. Furthermore, a 64 bit variant might be useful. PS: DPDK naming convention typically uses just "8"/"16"/"32" postfix to the function name, not "_u8"/"_u16"/"_u32".