Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nadezhda Ivanova
OpenLDAP
Commits
29ebd02e
Commit
29ebd02e
authored
Dec 19, 2015
by
Howard Chu
Browse files
MDB_VL32 support 64 bit DBs on 32 bit processors
parent
1ba5adb2
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
libraries/liblmdb/mdb.c
View file @
29ebd02e
This diff is collapsed.
Click to expand it.
libraries/liblmdb/midl.c
View file @
29ebd02e
...
...
@@ -354,5 +354,67 @@ int mdb_mid2l_append( MDB_ID2L ids, MDB_ID2 *id )
return
0
;
}
#ifdef MDB_VL32
unsigned
mdb_mid3l_search
(
MDB_ID3L
ids
,
MDB_ID
id
)
{
/*
* binary search of id in ids
* if found, returns position of id
* if not found, returns first position greater than id
*/
unsigned
base
=
0
;
unsigned
cursor
=
1
;
int
val
=
0
;
unsigned
n
=
(
unsigned
)
ids
[
0
].
mid
;
while
(
0
<
n
)
{
unsigned
pivot
=
n
>>
1
;
cursor
=
base
+
pivot
+
1
;
val
=
CMP
(
id
,
ids
[
cursor
].
mid
);
if
(
val
<
0
)
{
n
=
pivot
;
}
else
if
(
val
>
0
)
{
base
=
cursor
;
n
-=
pivot
+
1
;
}
else
{
return
cursor
;
}
}
if
(
val
>
0
)
{
++
cursor
;
}
return
cursor
;
}
int
mdb_mid3l_insert
(
MDB_ID3L
ids
,
MDB_ID3
*
id
)
{
unsigned
x
,
i
;
x
=
mdb_mid3l_search
(
ids
,
id
->
mid
);
if
(
x
<
1
)
{
/* internal error */
return
-
2
;
}
if
(
x
<=
ids
[
0
].
mid
&&
ids
[
x
].
mid
==
id
->
mid
)
{
/* duplicate */
return
-
1
;
}
/* insert id */
ids
[
0
].
mid
++
;
for
(
i
=
(
unsigned
)
ids
[
0
].
mid
;
i
>
x
;
i
--
)
ids
[
i
]
=
ids
[
i
-
1
];
ids
[
x
]
=
*
id
;
return
0
;
}
#endif
/* MDB_VL32 */
/** @} */
/** @} */
libraries/liblmdb/midl.h
View file @
29ebd02e
...
...
@@ -186,6 +186,20 @@ int mdb_mid2l_insert( MDB_ID2L ids, MDB_ID2 *id );
*/
int
mdb_mid2l_append
(
MDB_ID2L
ids
,
MDB_ID2
*
id
);
#ifdef MDB_VL32
typedef
struct
MDB_ID3
{
MDB_ID
mid
;
/**< The ID */
void
*
mptr
;
/**< The pointer */
unsigned
int
mcnt
;
/**< Number of pages */
unsigned
int
mref
;
/**< Refcounter */
}
MDB_ID3
;
typedef
MDB_ID3
*
MDB_ID3L
;
unsigned
mdb_mid3l_search
(
MDB_ID3L
ids
,
MDB_ID
id
);
int
mdb_mid3l_insert
(
MDB_ID3L
ids
,
MDB_ID3
*
id
);
#endif
/* MDB_VL32 */
/** @} */
/** @} */
#ifdef __cplusplus
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment