/* Use memcpy when source is higher than dest */ if (v_dst <= v_src) return memcpy(v_dst, v_src, c);
/* The following code tries to optimize the copy by using unsigned *alignment.Thiswillworkfineifbothsourceanddestinationare *alignedonthesameboundary.However,iftheyarealignedon *differentboundariesshiftswillbenecessary.Thismightresultin *badperformanceonMicroBlazesystemswithoutabarrelshifter.
*/ /* FIXME this part needs more test */ /* Do a descending copy - this is a bit trickier! */
dst += c;
src += c;
if (c >= 4) { unsigned value, buf_hold;
/* Align the destination to a word boundary. */ /* This is done in an endian independent manner. */
i_dst = (void *)dst; /* Choose a copy scheme based on the source */ /* alignment relative to destination. */ switch ((unsignedlong)src & 3) { case0x0: /* Both byte offsets are aligned */
i_src = (constvoid *)src;
for (; c >= 4; c -= 4)
*--i_dst = *--i_src;
src = (constvoid *)i_src; break; case0x1: /* Unaligned - Off by 1 */ /* Word align the source */
i_src = (constvoid *) (((unsigned)src + 4) & ~3); #ifndef __MICROBLAZEEL__ /* Load the holding buffer */
buf_hold = *--i_src >> 24;
for (; c >= 4; c -= 4) {
value = *--i_src;
*--i_dst = buf_hold << 8 | value;
buf_hold = value >> 24;
} #else /* Load the holding buffer */
buf_hold = (*--i_src & 0xFF) << 24;
for (; c >= 4; c -= 4) {
value = *--i_src;
*--i_dst = buf_hold |
((value & 0xFFFFFF00) >> 8);
buf_hold = (value & 0xFF) << 24;
} #endif /* Realign the source */
src = (constvoid *)i_src;
src += 1; break; case0x2: /* Unaligned - Off by 2 */ /* Word align the source */
i_src = (constvoid *) (((unsigned)src + 4) & ~3); #ifndef __MICROBLAZEEL__ /* Load the holding buffer */
buf_hold = *--i_src >> 16;
for (; c >= 4; c -= 4) {
value = *--i_src;
*--i_dst = buf_hold << 16 | value;
buf_hold = value >> 16;
} #else /* Load the holding buffer */
buf_hold = (*--i_src & 0xFFFF) << 16;
for (; c >= 4; c -= 4) {
value = *--i_src;
*--i_dst = buf_hold |
((value & 0xFFFF0000) >> 16);
buf_hold = (value & 0xFFFF) << 16;
} #endif /* Realign the source */
src = (constvoid *)i_src;
src += 2; break; case0x3: /* Unaligned - Off by 3 */ /* Word align the source */
i_src = (constvoid *) (((unsigned)src + 4) & ~3); #ifndef __MICROBLAZEEL__ /* Load the holding buffer */
buf_hold = *--i_src >> 8;
for (; c >= 4; c -= 4) {
value = *--i_src;
*--i_dst = buf_hold << 24 | value;
buf_hold = value >> 8;
} #else /* Load the holding buffer */
buf_hold = (*--i_src & 0xFFFFFF) << 8;
for (; c >= 4; c -= 4) {
value = *--i_src;
*--i_dst = buf_hold |
((value & 0xFF000000) >> 24);
buf_hold = (value & 0xFFFFFF) << 8;
} #endif /* Realign the source */
src = (constvoid *)i_src;
src += 3; break;
}
dst = (void *)i_dst;
}
/* simple fast copy, ... unless a cache boundary is crossed */ /* Finish off any remaining bytes */ switch (c) { case4:
*--dst = *--src;
fallthrough; case3:
*--dst = *--src;
fallthrough; case2:
*--dst = *--src;
fallthrough; case1:
*--dst = *--src;
} return v_dst;
}
EXPORT_SYMBOL(memmove); #endif/* CONFIG_OPT_LIB_FUNCTION */
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet am 2026-09-28)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.