Changeset 1ffa73b in mainline for uspace/lib/c/generic/mem.c


Ignore:
Timestamp:
2011-01-10T16:33:08Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b207803
Parents:
863d45e (diff), 6610565b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge development/ changes

File:
1 edited

Legend:

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

    r863d45e r1ffa73b  
    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.