strings.h

Go to the documentation of this file.
00001 #ifndef _STRINGS_H
00002 #define _STRINGS_H
00003 
00004 FILE_LICENCE ( GPL2_OR_LATER );
00005 
00006 #include <limits.h>
00007 #include <string.h>
00008 
00009 static inline __attribute__ (( always_inline )) int
00010 __constant_flsl ( unsigned long x ) {
00011         int r = 0;
00012 
00013 #if ULONG_MAX > 0xffffffff
00014         if ( x & 0xffffffff00000000UL ) {
00015                 x >>= 32;
00016                 r += 32;
00017         }
00018 #endif
00019         if ( x & 0xffff0000UL ) {
00020                 x >>= 16;
00021                 r += 16;
00022         }
00023         if ( x & 0xff00 ) {
00024                 x >>= 8;
00025                 r += 8;
00026         }
00027         if ( x & 0xf0 ) {
00028                 x >>= 4;
00029                 r += 4;
00030         }
00031         if ( x & 0xc ) {
00032                 x >>= 2;
00033                 r += 2;
00034         }
00035         if ( x & 0x2 ) {
00036                 x >>= 1;
00037                 r += 1;
00038         }
00039         if ( x & 0x1 ) {
00040                 r += 1;
00041         }
00042         return r;
00043 }
00044 
00045 /* We don't actually have these functions yet */
00046 extern int __flsl ( long x );
00047 
00048 #define flsl( x ) \
00049         ( __builtin_constant_p ( x ) ? __constant_flsl ( x ) : __flsl ( x ) )
00050 
00051 #define fls( x ) flsl ( x )
00052 
00053 extern int strcasecmp ( const char *s1, const char *s2 );
00054 
00055 static inline __attribute__ (( always_inline )) void
00056 bcopy ( const void *src, void *dest, size_t n ) {
00057         memmove ( dest, src, n );
00058 }
00059 
00060 static inline __attribute__ (( always_inline )) void
00061 bzero ( void *s, size_t n ) {
00062         memset ( s, 0, n );
00063 }
00064 
00065 #endif /* _STRINGS_H */

Generated on Tue Apr 6 20:01:09 2010 for gPXE by  doxygen 1.5.7.1