Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
87b4c33e
Commit
87b4c33e
authored
12 years ago
by
Guillaume Petiot
Browse files
Options
Downloads
Patches
Plain Diff
fixed bug
#1319
parent
2ed5e442
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/e-acsl/share/e-acsl/memory_model/e_acsl_bittree.c
+32
-1
32 additions, 1 deletion
...plugins/e-acsl/share/e-acsl/memory_model/e_acsl_bittree.c
with
32 additions
and
1 deletion
src/plugins/e-acsl/share/e-acsl/memory_model/e_acsl_bittree.c
+
32
−
1
View file @
87b4c33e
...
...
@@ -264,6 +264,28 @@ struct _block * _get_exact (void * ptr) {
}
/* return the block B containing ptr, starting from b and only exploring
left children, or NULL if such block does not exist
THIS METHOD IS INVOKED FROM _get_cont ONLY
DO NOT CALL IT FROM ANYWHERE ELSE */
struct
_block
*
_get_cont_by_left_child
(
void
*
ptr
,
struct
bittree
*
b
)
{
struct
bittree
*
tmp
=
b
;
assert
(((
unsigned
long
)
b
->
addr
&
b
->
mask
)
==
((
unsigned
long
)
ptr
&
b
->
mask
));
while
(
!
tmp
->
is_leaf
)
{
assert
(
tmp
->
left
!=
NULL
&&
tmp
->
right
!=
NULL
);
if
(((
unsigned
long
)
tmp
->
left
->
addr
&
tmp
->
mask
)
==
(
unsigned
long
)
ptr
)
tmp
=
tmp
->
left
;
else
return
NULL
;
}
assert
(
tmp
->
is_leaf
);
return
(
tmp
->
addr
==
ptr
)
?
tmp
->
leaf
:
NULL
;
}
/* return the block B containing ptr, such as :
begin addr of B <= ptr < (begin addr + size) of B
or NULL if such a block does not exist */
...
...
@@ -284,8 +306,17 @@ struct _block * _get_cont (void * ptr) {
assert
(
tmp
->
left
!=
NULL
&&
tmp
->
right
!=
NULL
);
/* the right child has the highest address, so we test it first */
if
(((
unsigned
long
)
tmp
->
right
->
addr
&
tmp
->
right
->
mask
)
==
(
unsigned
long
)
ptr
)
{
struct
_block
*
r
=
_get_cont_by_left_child
(
ptr
,
tmp
->
right
);
if
(
r
==
NULL
)
tmp
=
tmp
->
left
;
else
return
r
;
}
/* the right child has the highest address, so we test it first */
else
if
(((
unsigned
long
)
tmp
->
right
->
addr
&
tmp
->
right
->
mask
)
<=
((
unsigned
long
)
ptr
&
tmp
->
right
->
mask
))
tmp
=
tmp
->
right
;
else
if
(((
unsigned
long
)
tmp
->
left
->
addr
&
tmp
->
left
->
mask
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment