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
634bb58c
Commit
634bb58c
authored
5 years ago
by
Patrick Baudin
Browse files
Options
Downloads
Patches
Plain Diff
[wp] minor
parent
554bbfe7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/wp/Cint.ml
+14
-7
14 additions, 7 deletions
src/plugins/wp/Cint.ml
with
14 additions
and
7 deletions
src/plugins/wp/Cint.ml
+
14
−
7
View file @
634bb58c
...
@@ -657,6 +657,10 @@ let smp_eq_with_lnot a b = (* b1==~e <==> ~b1==e *)
...
@@ -657,6 +657,10 @@ let smp_eq_with_lnot a b = (* b1==~e <==> ~b1==e *)
(* --- Comparision with LSL / LSR --- *)
(* --- Comparision with LSL / LSR --- *)
(* -------------------------------------------------------------------------- *)
(* -------------------------------------------------------------------------- *)
let
two_power_k
k
=
try
Integer
.
two_power
k
with
Z
.
Overflow
->
raise
Not_found
let
two_power_k_minus1
k
=
let
two_power_k_minus1
k
=
try
Integer
.
pred
(
Integer
.
two_power
k
)
try
Integer
.
pred
(
Integer
.
two_power
k
)
with
Z
.
Overflow
->
raise
Not_found
with
Z
.
Overflow
->
raise
Not_found
...
@@ -699,10 +703,11 @@ let smp_cmp_with_lsl cmp a0 b0 =
...
@@ -699,10 +703,11 @@ let smp_cmp_with_lsl cmp a0 b0 =
(* p>=0 && q>=0 && p==q ==> ( ((a<<p)cmp(b<<q)) <==> (a cmp b) ) *)
(* p>=0 && q>=0 && p==q ==> ( ((a<<p)cmp(b<<q)) <==> (a cmp b) ) *)
cmp
a
b
cmp
a
b
else
if
a
==
b
&&
(
cmp
==
e_eq
||
is_positive_or_null
a
)
then
else
if
a
==
b
&&
(
cmp
==
e_eq
||
is_positive_or_null
a
)
then
(* p>=0 && q>=0 && a==b ==> ( ((a<<p)== (b<<q)) <==> (p == q) ) *)
(* p>=0 && q>=0 && a==b && a>=0 ==> ( ((a<<p)cmp(b<<q)) <==> (p cmp q) ) *)
(* p>=0 && q>=0 && a==b && a>=0 ==> ( ((a<<p)cmp(b<<q)) <==> (p cmp q) ) *)
cmp
p
q
cmp
p
q
else
if
a
==
b
&&
is_negative
a
then
else
if
a
==
b
&&
is_negative
a
then
(* p>=0 && q>=0 && a==b && a<0 ==> ( ((a<<p)
<=
(b<<q)) <==> (q cmp p) ) *)
(* p>=0 && q>=0 && a==b && a<0 ==> ( ((a<<p)
cmp
(b<<q)) <==> (q cmp p) ) *)
cmp
q
p
cmp
q
p
else
else
let
p
=
match_integer
p
in
let
p
=
match_integer
p
in
...
@@ -755,21 +760,23 @@ let smp_eq_with_lsr a0 b0 =
...
@@ -755,21 +760,23 @@ let smp_eq_with_lsr a0 b0 =
let
smp_leq_with_lsr
x
y
=
let
smp_leq_with_lsr
x
y
=
try
try
let
a
,
p
=
match_fun
f_lsr
y
|>
match_positive_or_null_integer_arg2
in
let
a
,
p
=
match_fun
f_lsr
y
|>
match_positive_or_null_integer_arg2
in
(* x <= (a >> p) *)
(* x <= (a >> p)
with p >= 0
*)
if
x
==
e_zero
then
if
x
==
e_zero
then
(* 0 <= (
a >> p
) <==> 0 <= a *)
(*
p >= 0 ==> (
0 <= (a >> p) <==> 0 <= a
)
*)
e_leq
e_zero
a
e_leq
e_zero
a
else
else
let
k
=
Integer
.
two_power
p
in
(* p >= 0 ==> ( x <= (a >> p) <= y <==> x <= a/(2**p) ) *)
let
k
=
two_power_k
p
in
e_leq
x
(
e_div
a
(
e_zint
k
))
e_leq
x
(
e_div
a
(
e_zint
k
))
with
Not_found
->
with
Not_found
->
let
a
,
p
=
match_fun
f_lsr
x
|>
match_positive_or_null_integer_arg2
in
let
a
,
p
=
match_fun
f_lsr
x
|>
match_positive_or_null_integer_arg2
in
(* (a >> p) <= y *)
(* (a >> p) <= y
with p >= 0
*)
if
y
==
e_zero
then
if
y
==
e_zero
then
(* (a >> p) <= 0 <==> a <= 0 *)
(*
p >= 0 ==> (
(a >> p) <= 0 <==> a <= 0
)
*)
e_leq
a
e_zero
e_leq
a
e_zero
else
else
let
k
=
Integer
.
two_power
p
in
(* p >= 0 ==> ( (a >> p) <= y <==> a/(2**p) <= y ) *)
let
k
=
two_power_k
p
in
e_leq
(
e_div
a
(
e_zint
k
))
y
e_leq
(
e_div
a
(
e_zint
k
))
y
(* Rewritting at export *)
(* Rewritting at export *)
...
...
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