From f85d684391adac08d54c3fdcda868e6392de2ffb Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Tue, 18 Jan 2011 21:38:47 +0000 Subject: [PATCH] Let the length of tarval be of type size_t. [r28251] --- ir/tv/tv.c | 20 ++++++++++---------- ir/tv/tv_t.h | 10 +++++----- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ir/tv/tv.c b/ir/tv/tv.c index 17a79d040..301da614e 100644 --- a/ir/tv/tv.c +++ b/ir/tv/tv.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -116,8 +116,8 @@ static const ieee_descriptor_t quad_desc = { 15, 112, 0, NORMAL }; * private functions ****************************************************************************/ #ifndef NDEBUG -static int hash_val(const void *value, unsigned int length); -static int hash_tv(ir_tarval *tv); +static unsigned hash_val(const void *value, size_t length); +static unsigned hash_tv(ir_tarval *tv); static void _fail_verify(ir_tarval *tv, const char* file, int line) { /* print a memory image of the tarval and throw an assertion */ @@ -145,16 +145,16 @@ inline static void tarval_verify(ir_tarval *tv) #endif /* NDEBUG */ /** Hash a tarval. */ -static int hash_tv(ir_tarval *tv) +static unsigned hash_tv(ir_tarval *tv) { - return (PTR_TO_INT(tv->value) ^ PTR_TO_INT(tv->mode)) + tv->length; + return (unsigned)((PTR_TO_INT(tv->value) ^ PTR_TO_INT(tv->mode)) + tv->length); } /** Hash a value. Treat it as a byte array. */ -static int hash_val(const void *value, unsigned int length) +static unsigned hash_val(const void *value, size_t length) { - unsigned int i; - unsigned int hash = 0; + size_t i; + unsigned hash = 0; /* scramble the byte - array */ for (i = 0; i < length; ++i) { @@ -190,7 +190,7 @@ static int cmp_tv(const void *p1, const void *p2, size_t n) } /** finds tarval with value/mode or creates new tarval */ -static ir_tarval *get_tarval(const void *value, int length, ir_mode *mode) +static ir_tarval *get_tarval(const void *value, size_t length, ir_mode *mode) { ir_tarval tv; @@ -217,7 +217,7 @@ static ir_tarval *get_tarval(const void *value, int length, ir_mode *mode) /** * handle overflow */ -static ir_tarval *get_tarval_overflow(const void *value, int length, ir_mode *mode) +static ir_tarval *get_tarval_overflow(const void *value, size_t length, ir_mode *mode) { char *temp; diff --git a/ir/tv/tv_t.h b/ir/tv/tv_t.h index 979b56e55..47621b800 100644 --- a/ir/tv/tv_t.h +++ b/ir/tv/tv_t.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved. + * Copyright (C) 1995-2011 University of Karlsruhe. All right reserved. * * This file is part of libFirm. * @@ -82,10 +82,10 @@ void finish_tarval(void); * irmode.h for predefined modes */ struct ir_tarval { - firm_kind kind; /**< must be k_tarval */ - ir_mode *mode; /**< the mode of the stored value */ - const void *value; /**< the value stored in an internal way... */ - unsigned int length; /**< the length of the stored value */ + firm_kind kind; /**< must be k_tarval */ + ir_mode *mode; /**< the mode of the stored value */ + const void *value; /**< the value stored in an internal way... */ + size_t length; /**< the length of the stored value */ }; /* inline functions */ -- 2.20.1