diff options
Diffstat (limited to 'zutil.c')
| -rw-r--r-- | zutil.c | 34 |
1 files changed, 20 insertions, 14 deletions
| @@ -150,28 +150,34 @@ const char * ZEXPORT zError(int err) { | |||
| 150 | 150 | ||
| 151 | #ifndef HAVE_MEMCPY | 151 | #ifndef HAVE_MEMCPY |
| 152 | 152 | ||
| 153 | void ZLIB_INTERNAL zmemcpy(Bytef* dest, const Bytef* source, uInt len) { | 153 | void ZLIB_INTERNAL zmemcpy(void FAR *dst, const void FAR *src, z_size_t n) { |
| 154 | if (len == 0) return; | 154 | uchf *p = dst; |
| 155 | do { | 155 | const uchf *q = src; |
| 156 | *dest++ = *source++; /* ??? to be unrolled */ | 156 | while (n) { |
| 157 | } while (--len != 0); | 157 | *p++ = *q++; |
| 158 | n--; | ||
| 159 | } | ||
| 158 | } | 160 | } |
| 159 | 161 | ||
| 160 | int ZLIB_INTERNAL zmemcmp(const Bytef* s1, const Bytef* s2, uInt len) { | 162 | int ZLIB_INTERNAL zmemcmp(const void FAR *s1, const void FAR *s2, z_size_t n) { |
| 161 | uInt j; | 163 | const uchf *p = s1, *q = s2; |
| 162 | 164 | while (n) { | |
| 163 | for (j = 0; j < len; j++) { | 165 | if (*p++ != *q++) |
| 164 | if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1; | 166 | return (int)p[-1] - (int)q[-1]; |
| 167 | n--; | ||
| 165 | } | 168 | } |
| 166 | return 0; | 169 | return 0; |
| 167 | } | 170 | } |
| 168 | 171 | ||
| 169 | void ZLIB_INTERNAL zmemzero(Bytef* dest, uInt len) { | 172 | void ZLIB_INTERNAL zmemzero(void FAR *b, z_size_t len) { |
| 173 | uchf *p = b; | ||
| 170 | if (len == 0) return; | 174 | if (len == 0) return; |
| 171 | do { | 175 | while (len) { |
| 172 | *dest++ = 0; /* ??? to be unrolled */ | 176 | *p++ = 0; |
| 173 | } while (--len != 0); | 177 | len--; |
| 178 | } | ||
| 174 | } | 179 | } |
| 180 | |||
| 175 | #endif | 181 | #endif |
| 176 | 182 | ||
| 177 | #ifndef Z_SOLO | 183 | #ifndef Z_SOLO |
