Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/mem.c

    r61bfc370 r63f8966  
    222222/** Compare two memory areas.
    223223 *
    224  * @param s1  Pointer to the first area to compare.
    225  * @param s2  Pointer to the second area to compare.
    226  * @param len Size of the first area in bytes. Both areas must have
    227  *            the same length.
    228  *
    229  * @return If len is 0, return zero. If the areas match, return
    230  *         zero. Otherwise return non-zero.
    231  *
    232  */
    233 int bcmp(const void *s1, const void *s2, size_t len)
    234 {
    235         uint8_t *u1 = (uint8_t *) s1;
    236         uint8_t *u2 = (uint8_t *) s2;
    237        
    238         for (; (len != 0) && (*u1++ == *u2++); len--);
    239        
     224 * @param s1            Pointer to the first area to compare.
     225 * @param s2            Pointer to the second area to compare.
     226 * @param len           Size of the first area in bytes. Both areas must have
     227 *                      the same length.
     228 * @return              If len is 0, return zero. If the areas match, return
     229 *                      zero. Otherwise return non-zero.
     230 */
     231int bcmp(const char *s1, const char *s2, size_t len)
     232{
     233        for (; len && *s1++ == *s2++; len--)
     234                ;
    240235        return len;
    241236}
Note: See TracChangeset for help on using the changeset viewer.