diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-03-26 16:25:35 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-03-26 16:25:35 -0700 |
commit | 9eddd22a7b53b1d02fbae0d987df8af122924248 (patch) | |
tree | 882f5152880b0b1aa2d7a0619d30065acc69fb16 /gpxe/src/include/strings.h | |
parent | bbb8f15936b851e6a0ef6f7bb2c95197bff35994 (diff) | |
download | syslinux-9eddd22a7b53b1d02fbae0d987df8af122924248.tar.gz |
Add gPXE into the source tree; build unified imagesyslinux-3.70-pre7
Diffstat (limited to 'gpxe/src/include/strings.h')
-rw-r--r-- | gpxe/src/include/strings.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/gpxe/src/include/strings.h b/gpxe/src/include/strings.h new file mode 100644 index 00000000..968a7c11 --- /dev/null +++ b/gpxe/src/include/strings.h @@ -0,0 +1,63 @@ +#ifndef _STRINGS_H +#define _STRINGS_H + +#include <limits.h> +#include <string.h> + +static inline __attribute__ (( always_inline )) int +__constant_flsl ( unsigned long x ) { + int r = 0; + +#if ULONG_MAX > 0xffffffff + if ( x & 0xffffffff00000000UL ) { + x >>= 32; + r += 32; + } +#endif + if ( x & 0xffff0000UL ) { + x >>= 16; + r += 16; + } + if ( x & 0xff00 ) { + x >>= 8; + r += 8; + } + if ( x & 0xf0 ) { + x >>= 4; + r += 4; + } + if ( x & 0xc ) { + x >>= 2; + r += 2; + } + if ( x & 0x2 ) { + x >>= 1; + r += 1; + } + if ( x & 0x1 ) { + r += 1; + } + return r; +} + +/* We don't actually have these functions yet */ +extern int __flsl ( long x ); + +#define flsl( x ) \ + ( __builtin_constant_p ( x ) ? __constant_flsl ( x ) : __flsl ( x ) ) + +#define fls( x ) flsl ( x ) + +extern int strcasecmp ( const char *s1, const char *s2 ); + +static inline __attribute__ (( always_inline )) void +bcopy ( const void *src, void *dest, size_t n ) { + memmove ( dest, src, n ); +} + +static inline __attribute__ (( always_inline )) void +bzero ( void *s, size_t n ) { + memset ( s, 0, n ); +} + +#endif /* _STRINGS_H */ |