On Tue, Feb 11, 2025 at 02:13:05PM -0800, Stephen Hemminger wrote:
> On Tue, 11 Feb 2025 14:02:05 -0800
> Andre Muezerie <andre...@linux.microsoft.com> wrote:
> 
> > There's no MSVC equivalent for compiler extension __builtin_constant_p,
> > so a workaround is needed.
> > 
> > Signed-off-by: Andre Muezerie <andre...@linux.microsoft.com>
> 
> Prefer that __rte_constant worked on all platforms,
> but template code is hard to maintain.

I'm not a huge fan of __rte_constant_with_default either. Here are some 
thoughts about it:

In test_memcpy_perf we could get rid of __builtin_constant_p or similar macros 
and just use the second argument (def) I'm passing to 
__rte_constant_with_default as the condition in the if() statement. I only used 
__rte_constant_with_default to keep the source code practically the same when 
using non-msvc compilers. But I don't see advantages beyond that, other than 
not having to pass that second parameter (def), which now we have to anyways.

__rte_constant_with_default is needed though in the first patch of this series, 
unless we decide to remove that extra check where it is being used.

Reply via email to