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)
 
 FILE_SECBOOT (PERMITTED)
 
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 123 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 132 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 141 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 149 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 158 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 167 of file strings.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED  )

◆ __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 22 of file strings.h.

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

References r, and x.

◆ __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 209 of file string.c.

209  {
210 
211  return strncasecmp ( first, second, ~( ( size_t ) 0 ) );
212 }
uint32_t first
First block in range.
Definition: pccrr.h:15
int strncasecmp(const char *first, const char *second, size_t max)
Compare case-insensitive strings.
Definition: string.c:222

References first, 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(), uart_find(), 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 222 of file string.c.

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

References first, max, and toupper().

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

Variable Documentation

◆ dest

void* dest

Definition at line 177 of file strings.h.

◆ len

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

Definition at line 177 of file strings.h.