Ignore:
Timestamp:
May 16, 2018, 8:31:35 PM (6 years ago)
Author:
satin@…
Message:

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libs/mini-libc/string.c

    r439 r444  
    2424#define  NULL  (void *)0
    2525
    26 ///////////////////////////
    27 inline int tolower( int c )
    28 {
    29    if (c >= 'A' && c <= 'Z') return (c | 0x20);
    30    else                      return c;
    31 }
    32 
    33 
    34 ///////////////////////////
    35 inline int toupper( int c )
    36 {
    37    if (c >= 'a' && c <= 'z') return (c & ~(0x20));
    38    else                      return c;
    39 }
     26#include <string.h>
    4027
    4128///////////////////////////////////////
     
    9279}
    9380
    94 //////////////////////////////////
    95 int strcasecmp( const char * str1,
    96                 const char * str2 )
    97 {
    98         char c1;
    99         char c2;
    10081
    101         do
    102     {
    103                 c1 = (char)toupper( (int)*++str1 );
    104                 c2 = (char)toupper( (int)*++str2 );
    105                 c2 = toupper(*++str2);
    106         }
    107     while(c1 && c1 == c2);
    108 
    109         return (c1 - c2);
    110 }
    11182
    11283///////////////////////////
     
    190161}
    191162
     163///////////////////////////////////////////////////////////////
     164void * memcpy(void *_dst, const void * _src, unsigned int size)
     165{
     166    unsigned int * dst = _dst;
     167    const unsigned int * src = _src;
     168    if (!((unsigned int) dst & 3) && !((unsigned int) src & 3) )
     169    {
     170        while (size > 3)
     171        {
     172            *dst++ = *src++;
     173            size -= 4;
     174        }
     175    }
    192176
     177    unsigned char *cdst = (unsigned char*)dst;
     178    unsigned char *csrc = (unsigned char*)src;
     179
     180    while (size--)
     181    {
     182        *cdst++ = *csrc++;
     183    }
     184    return _dst;
     185}
     186
     187//////////////////////////////////////////////////////////
     188inline void * memset(void * dst, int s, unsigned int size)
     189{
     190    char * a = (char *) dst;
     191    while (size--)
     192    {
     193        *a++ = (char)s;
     194    }
     195    return dst;
     196}
     197
     198
Note: See TracChangeset for help on using the changeset viewer.