Ignore:
File:
1 edited

Legend:

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

    r63f8966 r61bfc370  
    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  * @return              If len is 0, return zero. If the areas match, return
    229  *                      zero. Otherwise return non-zero.
    230  */
    231 int bcmp(const char *s1, const char *s2, size_t len)
    232 {
    233         for (; len && *s1++ == *s2++; len--)
    234                 ;
     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 */
     233int 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       
    235240        return len;
    236241}
Note: See TracChangeset for help on using the changeset viewer.