Changeset 3567 for trunk/kStuff/kLdr/kLdrHlp-gcc.c
- Timestamp:
- Aug 27, 2007, 9:54:05 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kStuff/kLdr/kLdrHlp-gcc.c
r3537 r3567 34 34 35 35 36 void *memchr(const void *pv, int ch, size_tcb)36 void *memchr(const void *pv, int ch, KSIZE cb) 37 37 { 38 38 const char *pb = pv; … … 47 47 48 48 49 int memcmp(const void *pv1, const void *pv2, size_tcb)49 int memcmp(const void *pv1, const void *pv2, KSIZE cb) 50 50 { 51 51 /* … … 53 53 */ 54 54 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_tu1 = *pu1++;63 const uintptr_tu2 = *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++; 64 64 if (u1 != u2) 65 65 return u1 > u2 ? 1 : -1; 66 cb -= sizeof( uintptr_t);66 cb -= sizeof(KUPTR); 67 67 } 68 68 if (!cb) … … 91 91 92 92 93 void *memcpy(void *pv1, const void *pv2, size_tcb)93 void *memcpy(void *pv1, const void *pv2, KSIZE cb) 94 94 { 95 95 void *pv1Start = pv1; … … 99 99 */ 100 100 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); 109 109 *pu1++ = *pu2++; 110 110 } … … 129 129 } 130 130 131 void *memset(void *pv, int ch, size_tcb)131 void *memset(void *pv, int ch, KSIZE cb) 132 132 { 133 133 void *pvStart = pv; … … 137 137 */ 138 138 if ( cb > 16 139 && !(( uintptr_t)pv & (sizeof(void *) - 1)))140 { 141 uintptr_t*pu = pv;142 uintptr_tu = ch | (ch << 8);139 && !((KUPTR)pv & (sizeof(void *) - 1))) 140 { 141 KUPTR *pu = pv; 142 KUPTR u = ch | (ch << 8); 143 143 u |= u << 16; 144 144 #if defined(__AMD64__) … … 146 146 #endif 147 147 148 while (cb >= sizeof( uintptr_t))149 { 150 cb -= sizeof( uintptr_t);148 while (cb >= sizeof(KUPTR)) 149 { 150 cb -= sizeof(KUPTR); 151 151 *pu++ = u; 152 152 } … … 180 180 181 181 182 int strncmp(const char *psz1, const char *psz2, size_tcch)182 int strncmp(const char *psz1, const char *psz2, KSIZE cch) 183 183 { 184 184 while (cch-- > 0) … … 207 207 } 208 208 209 size_tstrlen(const char *psz)209 KSIZE strlen(const char *psz) 210 210 { 211 211 const char *pszStart = psz;
Note:
See TracChangeset
for help on using the changeset viewer.