From 6a12c4be6be2050e965ff7a543d2c3119afbf971 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Mon, 19 May 2003 12:01:43 +0000 Subject: [PATCH] tarval_is_null() function added [r1224] --- ir/tv/tv.c | 10 ++++++++++ ir/tv/tv.h | 13 ++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/ir/tv/tv.c b/ir/tv/tv.c index 3520556f5..80ead53f8 100644 --- a/ir/tv/tv.c +++ b/ir/tv/tv.c @@ -578,6 +578,16 @@ int tarval_is_negative(tarval *a) } } +/* + * test if null, 1 means 'yes' + */ +int tarval_is_null(tarval *a) +{ + ir_mode *m = get_tarval_mode(a); + + return a == get_tarval_null(m); +} + /* * comparison */ diff --git a/ir/tv/tv.h b/ir/tv/tv.h index 8aa705df3..69f7c276a 100644 --- a/ir/tv/tv.h +++ b/ir/tv/tv.h @@ -284,13 +284,20 @@ ir_mode *get_tarval_mode (tarval *tv); /* Testing properties of the represented values */ -/** Returns 0 if tv is positive, else > 0. +/** + * Returns 1 if tv is negative * - * @todo - * not tested! + * @param a the tarval */ int tarval_is_negative(tarval *a); +/** + * Returns 1 if tv is null + * + * @param a the tarval + */ +int tarval_is_null(tarval *a); + /** The 'bad' tarval. */ extern tarval *tarval_bad; /** Returns the 'bad tarval. */ -- 2.20.1