comparison packages/language/c/libc/current/src/string/memchr.cxx @ 2:443894e2e912 ecos-v1_2_1-release

Block commit of eCos version 1.2.1
author jlarmour
date Tue, 11 May 1999 12:24:34 +0000
parents 3111d98ba7b3
children c38311975d4f
comparison
equal deleted inserted replaced
1:72f549f0d891 2:443894e2e912
20 // 20 //
21 // The Original Code is eCos - Embedded Cygnus Operating System, released 21 // The Original Code is eCos - Embedded Cygnus Operating System, released
22 // September 30, 1998. 22 // September 30, 1998.
23 // 23 //
24 // The Initial Developer of the Original Code is Cygnus. Portions created 24 // The Initial Developer of the Original Code is Cygnus. Portions created
25 // by Cygnus are Copyright (C) 1998 Cygnus Solutions. All Rights Reserved. 25 // by Cygnus are Copyright (C) 1998,1999 Cygnus Solutions. All Rights Reserved.
26 // ------------------------------------------- 26 // -------------------------------------------
27 // 27 //
28 //####COPYRIGHTEND#### 28 //####COPYRIGHTEND####
29 //=========================================================================== 29 //===========================================================================
30 //#####DESCRIPTIONBEGIN#### 30 //#####DESCRIPTIONBEGIN####
31 // 31 //
32 // Author(s): jlarmour 32 // Author(s): jlarmour
33 // Contributors: jlarmour@cygnus.co.uk 33 // Contributors: jlarmour
34 // Date: 1998-02-13 34 // Date: 1998-02-13
35 // Purpose: 35 // Purpose:
36 // Description: 36 // Description:
37 // Usage: 37 // Usage:
38 // 38 //
73 CYG_CHECK_DATA_PTR( s, "s is not a valid pointer!" ); 73 CYG_CHECK_DATA_PTR( s, "s is not a valid pointer!" );
74 74
75 #if defined(CYGIMP_LIBC_STRING_PREFER_SMALL_TO_FAST) || defined(__OPTIMIZE_SIZE__) 75 #if defined(CYGIMP_LIBC_STRING_PREFER_SMALL_TO_FAST) || defined(__OPTIMIZE_SIZE__)
76 const unsigned char *src = (const unsigned char *) s; 76 const unsigned char *src = (const unsigned char *) s;
77 77
78 c &= 0xff;
79
78 while (n--) 80 while (n--)
79 { 81 {
80 if (*src == c) 82 if (*src == c)
81 { 83 {
82 CYG_REPORT_RETVAL( src ); 84 CYG_REPORT_RETVAL( src );
90 const unsigned char *src = (const unsigned char *) s; 92 const unsigned char *src = (const unsigned char *) s;
91 CYG_WORD *aligned_src; 93 CYG_WORD *aligned_src;
92 CYG_WORD buffer; 94 CYG_WORD buffer;
93 CYG_WORD mask; 95 CYG_WORD mask;
94 cyg_ucount8 i; 96 cyg_ucount8 i;
97
98 c &= 0xff;
95 99
96 // If the size is small, or src is unaligned, then 100 // If the size is small, or src is unaligned, then
97 // use the bytewise loop. We can hope this is rare. 101 // use the bytewise loop. We can hope this is rare.
98 if (CYG_LIBC_STR_OPT_TOO_SMALL (n) || CYG_LIBC_STR_UNALIGNED (src)) 102 if (CYG_LIBC_STR_OPT_TOO_SMALL (n) || CYG_LIBC_STR_UNALIGNED (src))
99 { 103 {