Changeset 34120f10 in mainline for common/stdc/mem.c


Ignore:
Timestamp:
2023-10-27T19:38:31Z (7 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master, topic/msim-upgrade, topic/simplify-dev-export
Children:
63ed840
Parents:
c89ae25 (diff), 694ca3d6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge code deduplication work

TL;DR: Added directory /common, which now contains the sole existing
copy of ADT, printf_core, and a few other pieces. Should make changes
to any of those less of a headache.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • common/stdc/mem.c

    rc89ae25 r34120f10  
    3434 */
    3535
    36 #include <mem.h>
     36#include "../include/mem.h"
     37
    3738#include <stdlib.h>
    3839#include <stddef.h>
    3940#include <stdint.h>
    40 #include "private/cc.h"
     41#include "cc.h"
     42
     43#undef memset
     44#undef memcpy
     45#undef memcmp
     46#undef memmove
     47#undef memchr
    4148
    4249/** Fill memory block with a constant value. */
     50DO_NOT_DISCARD
    4351ATTRIBUTE_OPTIMIZE_NO_TLDP
    4452    void *memset(void *dest, int b, size_t n)
     
    99107} __attribute__((packed));
    100108
    101 static void *unaligned_memcpy(void *dst, const void *src, size_t n)
     109ATTRIBUTE_OPTIMIZE_NO_TLDP
     110    static void *unaligned_memcpy(void *dst, const void *src, size_t n)
    102111{
    103112        size_t i, j;
     
    116125
    117126/** Copy memory block. */
     127DO_NOT_DISCARD
    118128ATTRIBUTE_OPTIMIZE_NO_TLDP
    119129    void *memcpy(void *dst, const void *src, size_t n)
     
    194204
    195205/** Move memory block with possible overlapping. */
     206DO_NOT_DISCARD
     207ATTRIBUTE_OPTIMIZE_NO_TLDP
    196208void *memmove(void *dst, const void *src, size_t n)
    197209{
     
    239251 *
    240252 */
    241 int memcmp(const void *s1, const void *s2, size_t len)
     253DO_NOT_DISCARD
     254ATTRIBUTE_OPTIMIZE_NO_TLDP
     255    int memcmp(const void *s1, const void *s2, size_t len)
    242256{
    243257        uint8_t *u1 = (uint8_t *) s1;
     
    264278 *         bytes of @a s or @c NULL if not found.
    265279 */
     280DO_NOT_DISCARD
     281ATTRIBUTE_OPTIMIZE_NO_TLDP
    266282void *memchr(const void *s, int c, size_t n)
    267283{
Note: See TracChangeset for help on using the changeset viewer.