OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [newlib/] [libc/] [machine/] [hppa/] [memchr.S] - Blame information for rev 207

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 207 jeremybenn
/*
2
 *  (c) Copyright 1986 HEWLETT-PACKARD COMPANY
3
 *
4
 *  To anyone who acknowledges that this file is provided "AS IS"
5
 *  without any express or implied warranty:
6
 *      permission to use, copy, modify, and distribute this file
7
 *  for any purpose is hereby granted without fee, provided that
8
 *  the above copyright notice and this notice appears in all
9
 *  copies, and that the name of Hewlett-Packard Company not be
10
 *  used in advertising or publicity pertaining to distribution
11
 *  of the software without specific, written prior permission.
12
 *  Hewlett-Packard Company makes no representations about the
13
 *  suitability of this software for any purpose.
14
 */
15
 
16
/* SPECTRUM_ID: @(#)memchr.s    37.4     86/04/23 */
17
/*
18
 * memchr(s, c, n)
19
 *
20
 * returns pointer to first occurrence of char c
21
 * in first n characters of memory area s,
22
 * or null if c does not occur.
23
 */
24
 
25
#include "DEFS.h"
26
 
27
#define FROM    arg0
28
#define CHAR    arg1
29
#define COUNT   arg2
30
#define TEMP1   r19
31
 
32
ENTRY(memchr)
33
        comb,<= COUNT,r0,memchrexit     /* return if count is zero */
34
        copy    r0,ret0                 /* null if c not found in n chars */
35
        depi    0,23,24,CHAR            /* make char unsigned */
36
 
37
        ldbs,ma 1(FROM),TEMP1
38
memchrloop:
39
        comb,=,n        TEMP1,CHAR,memchrequal
40
        addib,<>        -1,COUNT,memchrloop
41
        ldbs,ma 1(FROM),TEMP1
42
        b,n     memchrexit
43
 
44
memchrequal:
45
        ldo     -1(FROM),ret0
46
 
47
memchrexit:
48
EXIT(memchr)

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.