From 90ecc248e200fee448001248dde0ca540dd3ef64 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Thu, 1 Dec 1994 08:00:00 +0000 Subject: Import of Linux/MIPS 1.1.68 --- include/asm-generic/bitops.h | 44 +++++++++++++++++++++++++++++++------------- include/asm-generic/string.h | 10 ++++++---- 2 files changed, 37 insertions(+), 17 deletions(-) (limited to 'include/asm-generic') diff --git a/include/asm-generic/bitops.h b/include/asm-generic/bitops.h index 130619840..7b0350da1 100644 --- a/include/asm-generic/bitops.h +++ b/include/asm-generic/bitops.h @@ -1,5 +1,5 @@ -#ifndef _ASM_GENERIC_BITOPS_H_ -#define _ASM_GENERIC_BITOPS_H_ +#ifndef _ASM_GENERIC_BITOPS_H +#define _ASM_GENERIC_BITOPS_H /* * For the benefit of those who are trying to port Linux to another @@ -16,38 +16,56 @@ * C language equivalents written by Theodore Ts'o, 9/26/92 */ -extern __inline__ int set_bit(int nr,int * addr) +#ifdef __USE_GENERIC_set_bit +extern __inline__ int set_bit(int nr, void * addr) { int mask, retval; + int *a = addr; - addr += nr >> 5; + a += nr >> 5; mask = 1 << (nr & 0x1f); cli(); - retval = (mask & *addr) != 0; - *addr |= mask; + retval = (mask & *a) != 0; + *a |= mask; sti(); return retval; } +#endif -extern __inline__ int clear_bit(int nr, int * addr) +#ifdef __USE_GENERIC_clear_bit +extern __inline__ int clear_bit(int nr, void * addr) { int mask, retval; + int *a = addr; - addr += nr >> 5; + a += nr >> 5; mask = 1 << (nr & 0x1f); cli(); - retval = (mask & *addr) != 0; - *addr &= ~mask; + retval = (mask & *a) != 0; + *a &= ~mask; sti(); return retval; } +#endif -extern __inline__ int test_bit(int nr, int * addr) +#ifdef __USE_GENERIC_test_bit +extern __inline__ int test_bit(int nr, void * addr) { int mask; + int *a = addr; - addr += nr >> 5; + a += nr >> 5; mask = 1 << (nr & 0x1f); - return ((mask & *addr) != 0); + 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 index 03fd6321f..c9cf8b483 100644 --- a/include/asm-generic/string.h +++ b/include/asm-generic/string.h @@ -154,24 +154,26 @@ extern inline char * strpbrk(const char * cs,const char * ct) #endif #ifdef __USE_PORTABLE_strtok + +extern char * ___strtok; + extern inline char * strtok(char * s,const char * ct) { char *sbegin, *send; - static char *ssave = NULL; - sbegin = s ? s : ssave; + sbegin = s ? s : ___strtok; if (!sbegin) { return NULL; } sbegin += strspn(sbegin,ct); if (*sbegin == '\0') { - ssave = NULL; + ___strtok = NULL; return( NULL ); } send = strpbrk( sbegin, ct); if (send && *send != '\0') *send++ = '\0'; - ssave = send; + ___strtok = send; return (sbegin); } #endif -- cgit v1.2.3