Skip to content

Commit cfe9fd0

Browse files
Andre Muezeriebruce-richardson
authored andcommitted
net/ice/base: define add-overflow builtin for MSVC
__builtin_add_overflow is gcc specific. A macro needs to be defined for code using this to be compiled with MSVC. Since only one driver is using this, this patch adds the macro to that driver only. It can be moved to some common place if/when needed. Signed-off-by: Andre Muezerie <[email protected]> Acked-by: Bruce Richardson <[email protected]> Acked-by: Morten Brørup <[email protected]>
1 parent b1f3a7a commit cfe9fd0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/net/intel/ice/base/ice_osdep.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,15 @@ writeq(uint64_t value, volatile void *addr)
128128
#define wr64(a, reg, value) writeq((value), (a)->hw_addr + (reg))
129129
#define rd64(a, reg) readq((a)->hw_addr + (reg))
130130

131+
#ifdef RTE_TOOLCHAIN_MSVC
132+
#define __builtin_add_overflow(a, b, res) \
133+
_Generic((a), \
134+
uint8_t : _addcarry_u8, \
135+
uint16_t : _addcarry_u16, \
136+
uint32_t : _addcarry_u32, \
137+
uint64_t : _addcarry_u64)(0, a, b, res)
138+
#endif
139+
131140
#endif /* __INTEL_NET_BASE_OSDEP__ */
132141

133142
#ifndef __always_unused

0 commit comments

Comments
 (0)