iPXE
Macros | Functions | Variables
strings.h File Reference

String functions. More...

#include <string.h>
#include <bits/strings.h>

Go to the source code of this file.

Macros

#define ffsll(x)   ( __builtin_constant_p ( x ) ? __constant_ffsll ( x ) : __ffsll ( x ) )
 Find first (i.e. More...
 
#define ffsl(x)   ( __builtin_constant_p ( x ) ? __constant_ffsl ( x ) : __ffsl ( x ) )
 Find first (i.e. More...
 
#define ffs(x)   ffsl ( x )
 Find first (i.e. More...
 
#define flsll(x)   ( __builtin_constant_p ( x ) ? __constant_flsll ( x ) : __flsll ( x ) )
 Find last (i.e. More...
 
#define flsl(x)   ( __builtin_constant_p ( x ) ? __constant_flsl ( x ) : __flsl ( x ) )
 Find last (i.e. More...
 
#define fls(x)   flsl ( x )
 Find last (i.e. More...
 

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
static __attribute__ ((always_inline)) int __constant_ffsll(unsigned long long x)
 Find first (i.e. More...
 
int __ffsll (long long x)
 
int __ffsl (long x)
 
int __flsll (long long x)
 
int __flsl (long x)
 
int __pure strcasecmp (const char *first, const char *second) __nonnull
 Compare case-insensitive strings. More...
 
int __pure strncasecmp (const char *first, const char *second, size_t max) __nonnull
 Compare case-insensitive strings. More...
 

Variables

static void * dest
 
static void size_t len
 

Detailed Description

String functions.

Definition in file strings.h.

Macro Definition Documentation

◆ ffsll

#define ffsll (   x)    ( __builtin_constant_p ( x ) ? __constant_ffsll ( x ) : __ffsll ( x ) )

Find first (i.e.

least significant) set bit

Parameters
xValue
Return values
lsbLeast significant bit set in value (LSB=1), or zero

Definition at line 122 of file strings.h.

◆ ffsl

#define ffsl (   x)    ( __builtin_constant_p ( x ) ? __constant_ffsl ( x ) : __ffsl ( x ) )

Find first (i.e.

least significant) set bit

Parameters
xValue
Return values
lsbLeast significant bit set in value (LSB=1), or zero

Definition at line 131 of file strings.h.

◆ ffs

#define ffs (   x)    ffsl ( x )

Find first (i.e.

least significant) set bit

Parameters
xValue
Return values
lsbLeast significant bit set in value (LSB=1), or zero

Definition at line 140 of file strings.h.

◆ flsll

#define flsll (   x)    ( __builtin_constant_p ( x ) ? __constant_flsll ( x ) : __flsll ( x ) )

Find last (i.e.

most significant) set bit

Parameters
xValue
Return values
msbMost significant bit set in value (LSB=1), or zero

Definition at line 148 of file strings.h.

◆ flsl

#define flsl (   x)    ( __builtin_constant_p ( x ) ? __constant_flsl ( x ) : __flsl ( x ) )

Find last (i.e.

most significant) set bit

Parameters
xValue
Return values
msbMost significant bit set in value (LSB=1), or zero

Definition at line 157 of file strings.h.

◆ fls

#define fls (   x)    flsl ( x )

Find last (i.e.

most significant) set bit

Parameters
xValue
Return values
msbMost significant bit set in value (LSB=1), or zero

Definition at line 166 of file strings.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ __attribute__()

static __attribute__ ( (always_inline)  )
inlinestatic

Find first (i.e.

Zero memory.

Copy memory.

Find last (i.e.

least significant) set bit

Parameters
xValue
Return values
lsbLeast significant bit set in value (LSB=1), or zero

most significant) set bit

Parameters
xValue
Return values
msbMost significant bit set in value (LSB=1), or zero
Parameters
srcSource
destDestination
lenLength
destDestination
lenLength

Definition at line 21 of file strings.h.

22  {
23  int r = 0;
24 
25  if ( ! ( x & 0x00000000ffffffffULL ) ) {
26  x >>= 32;
27  r += 32;
28  }
29  if ( ! ( x & 0x0000ffffUL ) ) {
30  x >>= 16;
31  r += 16;
32  }
33  if ( ! ( x & 0x00ff ) ) {
34  x >>= 8;
35  r += 8;
36  }
37  if ( ! ( x & 0x0f ) ) {
38  x >>= 4;
39  r += 4;
40  }
41  if ( ! ( x & 0x3 ) ) {
42  x >>= 2;
43  r += 2;
44  }
45  if ( ! ( x & 0x1 ) ) {
46  x >>= 1;
47  r += 1;
48  }
49  return ( x ? ( r + 1 ) : 0 );
50 }
static const uint8_t r[3][4]
MD4 shift amounts.
Definition: md4.c:53

References r.

◆ __ffsll()

int __ffsll ( long long  x)

◆ __ffsl()

int __ffsl ( long  x)

◆ __flsll()

int __flsll ( long long  x)

◆ __flsl()

int __flsl ( long  x)

◆ strcasecmp()

int __pure strcasecmp ( const char *  first,
const char *  second 
)

Compare case-insensitive strings.

Parameters
firstFirst string
secondSecond string
Return values
diffDifference

Definition at line 208 of file string.c.

208  {
209 
210  return strncasecmp ( first, second, ~( ( size_t ) 0 ) );
211 }
uint32_t first
First block in range.
Definition: pccrr.h:14
int strncasecmp(const char *first, const char *second, size_t max)
Compare case-insensitive strings.
Definition: string.c:221
static __always_inline int off_t userptr_t second
Definition: librm.h:166

References first, second, and strncasecmp().

Referenced by com32_identify(), comboot_identify(), efi_block_label(), efi_file_find(), efi_file_open(), efi_local_check_volume_name(), efi_snp_hii_fetch(), efi_snp_hii_store(), http_authentication(), http_digest_authenticate(), http_format_metadata_flavor(), http_parse_connection(), http_parse_content_encoding(), http_parse_digest_auth(), http_parse_header(), http_parse_transfer_encoding(), http_scheme(), parse_fc_els_handler(), string_test_exec(), sundance_probe(), tftp_process_option(), and xfer_uri_opener().

◆ strncasecmp()

int __pure strncasecmp ( const char *  first,
const char *  second,
size_t  max 
)

Compare case-insensitive strings.

Parameters
firstFirst string
secondSecond string
maxMaximum length to compare
Return values
diffDifference

Definition at line 221 of file string.c.

221  {
222  const uint8_t *first_bytes = ( ( const uint8_t * ) first );
223  const uint8_t *second_bytes = ( ( const uint8_t * ) second );
224  int diff;
225 
226  for ( ; max-- ; first_bytes++, second_bytes++ ) {
227  diff = ( toupper ( *first_bytes ) -
228  toupper ( *second_bytes ) );
229  if ( diff )
230  return diff;
231  if ( ! *first_bytes )
232  return 0;
233  }
234  return 0;
235 }
#define max(x, y)
Definition: ath.h:39
uint32_t first
First block in range.
Definition: pccrr.h:14
static int toupper(int character)
Convert character to upper case.
Definition: ctype.h:120
unsigned char uint8_t
Definition: stdint.h:10
static __always_inline int off_t userptr_t second
Definition: librm.h:166

References first, max, second, and toupper().

Referenced by efi_file_open(), strcasecmp(), string_test_exec(), and x509_check_dnsname().

Variable Documentation

◆ dest

void* dest

Definition at line 176 of file strings.h.

◆ len

size_t len
Initial value:
{
static const void * src
Definition: string.h:47
static void size_t len
Definition: strings.h:176
static void * dest
Definition: strings.h:176
void * memmove(void *dest, const void *src, size_t len) __nonnull

Definition at line 176 of file strings.h.