diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1995-11-14 08:00:00 +0000 |
---|---|---|
committer | <ralf@linux-mips.org> | 1995-11-14 08:00:00 +0000 |
commit | e7c2a72e2680827d6a733931273a93461c0d8d1b (patch) | |
tree | c9abeda78ef7504062bb2e816bcf3e3c9d680112 /include/asm-generic | |
parent | ec6044459060a8c9ce7f64405c465d141898548c (diff) |
Import of Linux/MIPS 1.3.0
Diffstat (limited to 'include/asm-generic')
-rw-r--r-- | include/asm-generic/bitops.h | 71 | ||||
-rw-r--r-- | include/asm-generic/string.h | 213 |
2 files changed, 0 insertions, 284 deletions
diff --git a/include/asm-generic/bitops.h b/include/asm-generic/bitops.h deleted file mode 100644 index 7b0350da1..000000000 --- a/include/asm-generic/bitops.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef _ASM_GENERIC_BITOPS_H -#define _ASM_GENERIC_BITOPS_H - -/* - * For the benefit of those who are trying to port Linux to another - * architecture, here are some C-language equivalents. You should - * recode these in the native assembly language, if at all possible. - * To guarantee atomicity, these routines call cli() and sti() to - * disable interrupts while they operate. (You have to provide inline - * routines to cli() and sti().) - * - * Also note, these routines assume that you have 32 bit integers. - * You will have to change this if you are trying to port Linux to the - * Alpha architecture or to a Cray. :-) - * - * C language equivalents written by Theodore Ts'o, 9/26/92 - */ - -#ifdef __USE_GENERIC_set_bit -extern __inline__ int set_bit(int nr, void * addr) -{ - int mask, retval; - int *a = addr; - - a += nr >> 5; - mask = 1 << (nr & 0x1f); - cli(); - retval = (mask & *a) != 0; - *a |= mask; - sti(); - return retval; -} -#endif - -#ifdef __USE_GENERIC_clear_bit -extern __inline__ int clear_bit(int nr, void * addr) -{ - int mask, retval; - int *a = addr; - - a += nr >> 5; - mask = 1 << (nr & 0x1f); - cli(); - retval = (mask & *a) != 0; - *a &= ~mask; - sti(); - return retval; -} -#endif - -#ifdef __USE_GENERIC_test_bit -extern __inline__ int test_bit(int nr, void * addr) -{ - int mask; - int *a = addr; - - a += nr >> 5; - mask = 1 << (nr & 0x1f); - return ((mask & *a) != 0); -} -#endif - -#ifdef __USE_GENERIC_find_first_zero_bit -#error "Generic find_first_zero_bit() not written yet." -#endif - -#ifdef __USE_GENERIC_find_next_zero_bit -#error "Generic find_next_zero_bit() not written yet." -#endif - -#endif /* _ASM_GENERIC_BITOPS_H */ diff --git a/include/asm-generic/string.h b/include/asm-generic/string.h deleted file mode 100644 index c9cf8b483..000000000 --- a/include/asm-generic/string.h +++ /dev/null @@ -1,213 +0,0 @@ -/* - * include/asm-generic/string.h - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - */ - -#ifndef _ASM_GENERIC_STRING_H_ -#define _ASM_GENERIC_STRING_H_ - -/* - * Portable string functions. These are not complete: - * memcpy() and memmove() are still missing. - */ - -#ifdef __USE_PORTABLE_strcpy -extern inline char * strcpy(char * dest,const char *src) -{ - char *xdest = dest; - - while(*dest++ = *src++); - - return xdest; -} -#endif - -#ifdef __USE_PORTABLE_strncpy -extern inline char * strncpy(char * dest,const char *src,size_t count) -{ - char *xdest = dest; - - while((*dest++ = *src++) && --count); - - return dest; -} -#endif - -#ifdef __USE_PORTABLE_strcat -extern inline char * strcat(char * dest, const char * src) -{ - char *tmp = dest; - - while (*dest) - dest++; - while ((*dest++ = *src++)) - ; - - return tmp; -} -#endif - -#ifdef __USE_PORTABLE_strncat -extern inline char * strncat(char *dest, const char *src, size_t count) -{ - char *tmp = dest; - - if (count) { - while (*dest) - dest++; - while ((*dest++ = *src++)) { - if (--count == 0) - break; - } - } - - return tmp; -} -#endif - -#ifdef __USE_PORTABLE_strcmp -extern int strcmp(const char * cs,const char * ct) -{ - register char __res; - - while(1) { - if(__res = *cs - *ct++ && *cs++) - break; - } - - return __res; -} -#endif - -#ifdef __USE_PORTABLE_strncmp -extern inline int strncmp(const char * cs,const char * ct,size_t count) -{ - register char __res; - - while(count) { - if(__res = *cs - *ct++ || !*cs++) - break; - count--; - } - - return __res; -} -#endif - -#ifdef __USE_PORTABLE_strchr -extern inline char * strchr(const char * s,char c) -{ - const char ch = c; - - for(; *s != ch; ++s) - if (*s == '\0') - return( NULL ); - return( (char *) s); -} -#endif - -#ifdef __USE_PORTABLE_strlen -extern inline size_t strlen(const char * s) -{ - const char *sc; - for (sc = s; *sc != '\0'; ++sc) ; - return(sc - s); -} -#endif - -#ifdef __USE_PORTABLE_strspn -extern inline size_t strspn(const char *s, const char *accept) -{ - const char *p; - const char *a; - size_t count = 0; - - for (p = s; *p != '\0'; ++p) - { - for (a = accept; *a != '\0'; ++a) - if (*p == *a) - break; - if (*a == '\0') - return count; - else - ++count; - } - - return count; -} -#endif - -#ifdef __USE_PORTABLE_strpbrk -extern inline char * strpbrk(const char * cs,const char * ct) -{ - const char *sc1,*sc2; - - for( sc1 = cs; *sc1 != '\0'; ++sc1) - for( sc2 = ct; *sc2 != '\0'; ++sc2) - if (*sc1 == *sc2) - return((char *) sc1); - return( NULL ); -} -#endif - -#ifdef __USE_PORTABLE_strtok - -extern char * ___strtok; - -extern inline char * strtok(char * s,const char * ct) -{ - char *sbegin, *send; - - sbegin = s ? s : ___strtok; - if (!sbegin) { - return NULL; - } - sbegin += strspn(sbegin,ct); - if (*sbegin == '\0') { - ___strtok = NULL; - return( NULL ); - } - send = strpbrk( sbegin, ct); - if (send && *send != '\0') - *send++ = '\0'; - ___strtok = send; - return (sbegin); -} -#endif - -#ifdef __USE_PORTABLE_memset -extern inline void * memset(void * s,char c,size_t count) -{ - void *xs = s; - - while(n--) - *s++ = c; - - return xs; -} -#endif - -#ifdef __USE_PORTABLE_memcpy -#error "Portable memcpy() not implemented yet" -#endif - -#ifdef __USE_PORTABLE_memmove -#error "Portable memmove() not implemented yet" -#endif - -#ifdef __USE_PORTABLE_memcmp -extern inline int memcmp(const void * cs,const void * ct,size_t count) -{ - const unsigned char *su1, *su2; - - for( su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--) - if (*su1 != *su2) - return((*su1 < *su2) ? -1 : +1); - return(0); -} -#endif - -#endif /* _ASM_GENERIC_STRING_H_ */ |