/[avr-libc]/avr-libc/include/string.h
ViewVC logotype

Diff of /avr-libc/include/string.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10 by aesok, Sun Oct 16 11:14:36 2005 UTC revision 1.11 by aesok, Mon Oct 17 21:47:06 2005 UTC
# Line 61  extern "C" { Line 61  extern "C" {
61      \note If the strings you are working on resident in program space (flash),      \note If the strings you are working on resident in program space (flash),
62      you will need to use the string functions described in \ref avr_pgmspace. */      you will need to use the string functions described in \ref avr_pgmspace. */
63    
64    
65  /** \ingroup avr_string  /** \ingroup avr_string
66    
67      This function find the first (least significant) bit set in the input value.      This macro find the first (least significant) bit set in the input value.
68            
69      \returns The ffs() function returns the position of the first      \returns The _FFS() macro returns the position of the first
70      (least significant) bit set in the word val, or 0 if no bits are set.      (least significant) bit set in the word val, or 0 if no bits are set.
71      The least significant bit is position 1.      The least significant bit is position 1.    
72            
73      \note The ffs() (and only ffs()) is implemented as macro, that evaluates      \note The _FFS() macro, that evaluates a constant argument
74      a constant argument at compile time.        */      at compile time.
75  extern int ffs (int val) __attribute__((const));      
76        \note Expression, like '_FFS(_FFS(_FFS(...(CONSTANT)))', take very
77  /* FIXME: expression, like 'ffs(ffs(ffs(...(CONSTANT)))', take very      large amount of memory at compile time.     */
78     large amount of memory at compile time.      */  #define _FFS(x) ( \
 #define ffs(x) ( \  
79      __builtin_constant_p (x) ?  \      __builtin_constant_p (x) ?  \
80          ( (x) & 1 ? 1           \          ( (x) & 1 ? 1           \
81          : (x) & 2 ? 2           \          : (x) & 2 ? 2           \
# Line 94  extern int ffs (int val) __attribute__(( Line 94  extern int ffs (int val) __attribute__((
94          : (x) & 040000 ? 15     \          : (x) & 040000 ? 15     \
95          : (x) & 0100000 ? 16    \          : (x) & 0100000 ? 16    \
96          : 0 )                   \          : 0 )                   \
97      : ffs(x) )          : ffs(x) )
   
 /** \ingroup avr_string  
     Same as ffs(), for an argument of type long.        */  
 extern int ffsl (long val) __attribute__((const));  
   
 /** \ingroup avr_string  
     Same as ffs(), for an argument of type long long.   */  
 extern int ffsll (long long val) __attribute__((const));  
98    
99    extern int ffs (int val) __attribute__((const));
100    extern int ffsl (long) __attribute__((const));
101    extern int ffsll (long long) __attribute__((const));
102  extern void *memccpy(void *, const void *, int, size_t);  extern void *memccpy(void *, const void *, int, size_t);
103  extern void *memchr(const void *, int, size_t) __ATTR_PURE__;  extern void *memchr(const void *, int, size_t) __ATTR_PURE__;
104  extern int memcmp(const void *, const void *, size_t) __ATTR_PURE__;  extern int memcmp(const void *, const void *, size_t) __ATTR_PURE__;

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26