lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | /* $Id: memchr.S,v 1.1 2000/04/14 16:49:01 mjd Exp $ |
| 2 | * |
| 3 | * "memchr" implementation of SuperH |
| 4 | * |
| 5 | * Copyright (C) 1999 Niibe Yutaka |
| 6 | * |
| 7 | * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. |
| 8 | */ |
| 9 | |
| 10 | /* |
| 11 | * void *memchr(const void *s, int c, size_t n); |
| 12 | */ |
| 13 | |
| 14 | #include <sysdep.h> |
| 15 | |
| 16 | ENTRY(memchr) |
| 17 | tst r6,r6 |
| 18 | bt/s 2f |
| 19 | exts.b r5,r5 |
| 20 | 1: mov.b @r4,r1 |
| 21 | cmp/eq r1,r5 |
| 22 | bt/s 3f |
| 23 | dt r6 |
| 24 | bf/s 1b |
| 25 | add #1,r4 |
| 26 | 2: mov #0,r4 |
| 27 | 3: rts |
| 28 | mov r4,r0 |
| 29 | END(memchr) |
| 30 | libc_hidden_def (memchr) |