pike.git/
src/
pike_types.c
Branch:
Tag:
Non-build tags
All tags
No tags
2011-03-25
2011-03-25 12:38:15 by Henrik Grubbström (Grubba) <grubba@grubba.org>
160954421f15fa33b8e8ea6a70748d3484a91d28 (
37
lines) (+
14
/-
23
)
[
Show
|
Annotate
]
Branch:
7.9
Cleaned up the code for generating enum types.
2765:
* This is a bit more lenient than the default further below, * and is used for generating the type for enums. */
-
if (max2 >= max1) {
-
if
(max1
>
0)
{
-
max2 |= max1;
-
}
-
} else if (max2 > 0) {
-
max2 |= max1;
-
} else {
-
max2 = max1;
-
}
-
if (
min2
<
=
min1) {
-
if (min1 <
0)
{
-
min2 &
=
min1;
-
}
-
} else if (min2 <
0
) {
-
min2 &= min1
;
-
} else {
-
min2 = min1;
-
}
-
/* Ensure that zero is always in the range. */
+
+
/*
Ensure
that
zero
is
always
in
the
range.
+
*
This
also
ensures
that
there'll
be
an
overlap.
+
*/
+
if (
max1
< 0)
max1
= 0;
if (max2 < 0) max2 = 0;
-
+
if (min1 > 0) min1 = 0;
if (min2 > 0) min2 = 0;
-
Pike_compiler-
>
type_stackp--;
-
free_type(top)
;
-
push_int_type
(min2
,
max2
)
;
-
break
;
+
+
/* Both max values are now
>
= 0, so this or is safe. */
+
max1 |= max2
;
+
+
if
(
(min1 < 0) && (
min2
< 0
)
) {
+
min1 &= min2
;
} }
-
+
}
if ((min1 > max2) && (min1 > max2 + 1)) { /* No overlap. */