Ignore:
Timestamp:
Aug 27, 2007, 9:54:05 PM (18 years ago)
Author:
bird
Message:

Use the new type system.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kStuff/kLdr/kLdrHlp-gcc.c

    r3537 r3567  
    3434
    3535
    36 void *memchr(const void *pv, int ch, size_t cb)
     36void *memchr(const void *pv, int ch, KSIZE cb)
    3737{
    3838    const char *pb = pv;
     
    4747
    4848
    49 int memcmp(const void *pv1, const void *pv2, size_t cb)
     49int memcmp(const void *pv1, const void *pv2, KSIZE cb)
    5050{
    5151    /*
     
    5353     */
    5454    if (    cb > 16
    55         &&  !((uintptr_t)pv1 & (sizeof(void *) - 1))
    56         &&  !((uintptr_t)pv2 & (sizeof(void *) - 1)) )
    57     {
    58         const uintptr_t *pu1 = pv1;
    59         const uintptr_t *pu2 = pv2;
    60         while (cb >= sizeof(uintptr_t))
    61         {
    62             const uintptr_t u1 = *pu1++;
    63             const uintptr_t u2 = *pu2++;
     55        &&  !((KUPTR)pv1 & (sizeof(void *) - 1))
     56        &&  !((KUPTR)pv2 & (sizeof(void *) - 1)) )
     57    {
     58        const KUPTR *pu1 = pv1;
     59        const KUPTR *pu2 = pv2;
     60        while (cb >= sizeof(KUPTR))
     61        {
     62            const KUPTR u1 = *pu1++;
     63            const KUPTR u2 = *pu2++;
    6464            if (u1 != u2)
    6565                return u1 > u2 ? 1 : -1;
    66             cb -= sizeof(uintptr_t);
     66            cb -= sizeof(KUPTR);
    6767        }
    6868        if (!cb)
     
    9191
    9292
    93 void *memcpy(void *pv1, const void *pv2, size_t cb)
     93void *memcpy(void *pv1, const void *pv2, KSIZE cb)
    9494{
    9595    void *pv1Start = pv1;
     
    9999     */
    100100    if (    cb > 16
    101         &&  !((uintptr_t)pv1 & (sizeof(void *) - 1))
    102         &&  !((uintptr_t)pv2 & (sizeof(void *) - 1)) )
    103     {
    104         uintptr_t       *pu1 = pv1;
    105         const uintptr_t *pu2 = pv2;
    106         while (cb >= sizeof(uintptr_t))
    107         {
    108             cb -= sizeof(uintptr_t);
     101        &&  !((KUPTR)pv1 & (sizeof(void *) - 1))
     102        &&  !((KUPTR)pv2 & (sizeof(void *) - 1)) )
     103    {
     104        KUPTR       *pu1 = pv1;
     105        const KUPTR *pu2 = pv2;
     106        while (cb >= sizeof(KUPTR))
     107        {
     108            cb -= sizeof(KUPTR);
    109109            *pu1++ = *pu2++;
    110110        }
     
    129129}
    130130
    131 void *memset(void *pv, int ch, size_t cb)
     131void *memset(void *pv, int ch, KSIZE cb)
    132132{
    133133    void *pvStart = pv;
     
    137137     */
    138138    if (    cb > 16
    139         &&  !((uintptr_t)pv & (sizeof(void *) - 1)))
    140     {
    141         uintptr_t  *pu = pv;
    142         uintptr_t   u = ch | (ch << 8);
     139        &&  !((KUPTR)pv & (sizeof(void *) - 1)))
     140    {
     141        KUPTR  *pu = pv;
     142        KUPTR   u = ch | (ch << 8);
    143143        u |= u << 16;
    144144#if defined(__AMD64__)
     
    146146#endif
    147147
    148         while (cb >= sizeof(uintptr_t))
    149         {
    150             cb -= sizeof(uintptr_t);
     148        while (cb >= sizeof(KUPTR))
     149        {
     150            cb -= sizeof(KUPTR);
    151151            *pu++ = u;
    152152        }
     
    180180
    181181
    182 int strncmp(const char *psz1, const char *psz2, size_t cch)
     182int strncmp(const char *psz1, const char *psz2, KSIZE cch)
    183183{
    184184    while (cch-- > 0)
     
    207207}
    208208
    209 size_t strlen(const char *psz)
     209KSIZE strlen(const char *psz)
    210210{
    211211    const char *pszStart = psz;
Note: See TracChangeset for help on using the changeset viewer.