Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
28b5ab75
Commit
28b5ab75
authored
Nov 16, 2014
by
Christoph Mallon
Browse files
tv: Simplify implementation of tarval_abs().
parent
5a6e16ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
ir/tv/tv.c
View file @
28b5ab75
...
...
@@ -990,31 +990,9 @@ ir_tarval *tarval_divmod(ir_tarval *a, ir_tarval *b, ir_tarval **mod)
ir_tarval
*
tarval_abs
(
ir_tarval
*
a
)
{
assert
(
mode_is_num
(
a
->
mode
));
switch
(
get_mode_sort
(
a
->
mode
))
{
case
irms_int_number
:
case
irms_reference
:
if
(
sc_comp
(
a
->
value
,
get_mode_null
(
a
->
mode
)
->
value
)
==
ir_relation_less
)
{
sc_word
*
buffer
=
ALLOCAN
(
sc_word
,
sc_value_length
);
sc_neg
(
a
->
value
,
buffer
);
return
get_tarval_overflow
(
buffer
,
a
->
length
,
a
->
mode
);
}
return
a
;
case
irms_float_number
:
if
(
fc_is_negative
((
const
fp_value
*
)
a
->
value
))
{
fc_neg
((
const
fp_value
*
)
a
->
value
,
NULL
);
return
get_tarval_overflow
(
fc_get_buffer
(),
fc_get_buffer_length
(),
a
->
mode
);
}
return
a
;
case
irms_auxiliary
:
case
irms_data
:
case
irms_internal_boolean
:
panic
(
"operation not defined on mode"
);
}
panic
(
"invalid mode sort"
);
if
(
tarval_is_negative
(
a
))
return
tarval_neg
(
a
);
return
a
;
}
ir_tarval
*
tarval_and
(
ir_tarval
*
a
,
ir_tarval
*
b
)
...
...
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