On Sun, 11 Jan 2026 15:52:28 +0000
Konstantin Ananyev <[email protected]> wrote:

> > > + /* Faster way when size is known at build time. */
> > > + if (__rte_constant(n)) {
> > > +         if (n == 2)
> > > +                 return memcpy(dst, src, 2);
> > > +         if (n == 4)
> > > +                 return memcpy(dst, src, 4);
> > > +         if (n == 6) /* 4 + 2 */
> > > +                 return memcpy(dst, src, 6);
> > > +         if (n == 8)
> > > +                 return memcpy(dst, src, 8);
> > > +         if (n == 10) /* 8 + 2 */
> > > +                 return memcpy(dst, src, 10);
> > > +         if (n == 12) /* 8 + 4 */
> > > +                 return memcpy(dst, src, 12);
> > > +         if (n == 16) {
> > > +                 rte_mov16((uint8_t *)dst, (const uint8_t *)src);
> > > +                 return dst;
> > > +         }  
> 
> If n is constant; wouldn't compiler unroll such memcpy itself?
> Specially for such small (<=16) values?
> I mean. can't we just:
> If (n < 16) memcpy(dst, src, n); else rte_mov16(dst, src); 

Yes, better to just let compiler do its own inline with all constant
sizes.

Reply via email to