summaryrefslogtreecommitdiffhomepage
path: root/ir/tv
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2016-01-24 01:43:59 +0100
committerMatthias Braun <matze@braunis.de>2016-01-24 01:46:17 +0100
commitfacad40a3dd5fcfaa7ccf1f44d6c7daa3d523579 (patch)
tree94353daeab9e02bf793ab250a2852c5d082dd3c0 /ir/tv
parent876e8c6a5ceff8085a0e348541b7545c5871aea9 (diff)
tv: Only allow tarval_popcount on twos_complement modes
Diffstat (limited to 'ir/tv')
-rw-r--r--ir/tv/tv.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/ir/tv/tv.c b/ir/tv/tv.c
index 0e691b8..f5757a9 100644
--- a/ir/tv/tv.c
+++ b/ir/tv/tv.c
@@ -1275,9 +1275,7 @@ unsigned char get_tarval_sub_bits(ir_tarval const *tv, unsigned byte_ofs)
int get_tarval_popcount(ir_tarval const *tv)
{
ir_mode *const mode = get_tarval_mode(tv);
- if (!mode_is_int(mode))
- return -1;
-
+ assert(get_mode_arithmetic(mode) == irma_twos_complement);
return sc_popcount(tv->value, get_mode_size_bits(mode));
}