source: bootcd/isolinux/syslinux-6.03/gpxe/src/include/strings.h

Last change on this file was e16e8f2, checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago

bootstuff

  • Property mode set to 100644
File size: 1.1 KB
RevLine 
[e16e8f2]1#ifndef _STRINGS_H
2#define _STRINGS_H
3
4FILE_LICENCE ( GPL2_OR_LATER );
5
6#include <limits.h>
7#include <string.h>
8
9static inline __attribute__ (( always_inline )) int
10__constant_flsl ( unsigned long x ) {
11        int r = 0;
12
13#if ULONG_MAX > 0xffffffff
14        if ( x & 0xffffffff00000000UL ) {
15                x >>= 32;
16                r += 32;
17        }
18#endif
19        if ( x & 0xffff0000UL ) {
20                x >>= 16;
21                r += 16;
22        }
23        if ( x & 0xff00 ) {
24                x >>= 8;
25                r += 8;
26        }
27        if ( x & 0xf0 ) {
28                x >>= 4;
29                r += 4;
30        }
31        if ( x & 0xc ) {
32                x >>= 2;
33                r += 2;
34        }
35        if ( x & 0x2 ) {
36                x >>= 1;
37                r += 1;
38        }
39        if ( x & 0x1 ) {
40                r += 1;
41        }
42        return r;
43}
44
45/* We don't actually have these functions yet */
46extern int __flsl ( long x );
47
48#define flsl( x ) \
49        ( __builtin_constant_p ( x ) ? __constant_flsl ( x ) : __flsl ( x ) )
50
51#define fls( x ) flsl ( x )
52
53extern int strcasecmp ( const char *s1, const char *s2 );
54
55static inline __attribute__ (( always_inline )) void
56bcopy ( const void *src, void *dest, size_t n ) {
57        memmove ( dest, src, n );
58}
59
60static inline __attribute__ (( always_inline )) void
61bzero ( void *s, size_t n ) {
62        memset ( s, 0, n );
63}
64
65#endif /* _STRINGS_H */
Note: See TracBrowser for help on using the repository browser.