Toggle navigation
Documentation
The friendly Operating System for the Internet of Things
Main Page
Related Pages
Modules
Data Structures
Data Structures
Class Hierarchy
Data Fields
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
a
b
d
e
f
g
h
j
l
m
n
o
p
r
s
t
u
w
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
Related Functions
Files
File List
Globals
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
n
p
q
r
s
t
u
v
w
x
z
Enumerations
_
a
b
c
d
e
g
h
i
k
l
m
n
p
q
r
s
t
u
v
x
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
•
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
binsearch.h
1
/*
2
* Copyright (C) 2018 Freie Universität Berlin
3
*
4
* This file is subject to the terms and conditions of the GNU Lesser
5
* General Public License v2.1. See the file LICENSE in the top level
6
* directory for more details.
7
*/
8
44
#ifndef BINSEARCH_H
45
#define BINSEARCH_H
46
47
#include <stdint.h>
48
#include <
errno.h
>
49
50
#ifdef __cplusplus
51
extern
"C"
{
52
#endif
53
57
#define _ENSURE_LVALUE(x) ((void)sizeof(&(x)))
58
63
#define _ARRAY_STRIDE(arr) ((size_t)((const uint8_t *)((arr) + 1) - (const uint8_t *)(arr)))
64
69
#define _ARRAY_MEMBER_OFFS(arr, member) \
70
((size_t)((const uint8_t *)(&((arr)->member)) - (const uint8_t *)(arr)))
71
82
#define BINSEARCH_STR(arr, nmemb, member, str, n) \
83
(_ENSURE_LVALUE(arr), \
84
(binsearch_str((arr), _ARRAY_MEMBER_OFFS(arr, member), _ARRAY_STRIDE(arr), \
85
(nmemb), (str), (n))) \
86
)
87
95
#define BINSEARCH_STR_P(arr, nmemb, member, str, n) \
96
(_ENSURE_LVALUE(arr), \
97
(binsearch_str_p((arr), _ARRAY_MEMBER_OFFS(arr, member), _ARRAY_STRIDE(arr), \
98
(nmemb), (str), (n))) \
99
)
100
120
int
binsearch_str(
const
void
*start,
size_t
offset,
size_t
stride,
size_t
nmemb,
121
const
char
*str,
size_t
n);
122
129
const
void
*binsearch_str_p(
const
void
*start,
size_t
offset,
size_t
stride,
130
size_t
nmemb,
const
char
*str,
size_t
n);
131
132
133
#ifdef __cplusplus
134
}
135
#endif
136
139
#endif
/* BINSEARCH_H */
errno.h
Generated on Tue Nov 24 2020 19:46:51 by
1.8.17