From f61f15d2fcba8d632ad59335615fb1fa4bdcdf6c Mon Sep 17 00:00:00 2001 From: jtvolpe Date: Sun, 20 May 2001 03:26:07 +0000 Subject: [PATCH] Fixed up implicit data type conversions git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@830 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- src/SDCCicode.c | 12 ++++++------ src/SDCCicode.h | 2 +- src/SDCCloop.c | 12 ++++++------ src/SDCCval.h | 2 +- src/pic/glue.c | 4 ++-- src/port.h | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/SDCCicode.c b/src/SDCCicode.c index 29867e0f..6196ce22 100644 --- a/src/SDCCicode.c +++ b/src/SDCCicode.c @@ -954,7 +954,7 @@ operandOperation (operand * left, operand * right, break; case RRC: { - long i = operandLitValue (left); + long i = (long) operandLitValue (left); retval = operandFromLit ((i >> (getSize (operandType (left)) * 8 - 1)) | (i << 1)); @@ -962,7 +962,7 @@ operandOperation (operand * left, operand * right, break; case RLC: { - long i = operandLitValue (left); + long i = (long) operandLitValue (left); retval = operandFromLit ((i << (getSize (operandType (left)) * 8 - 1)) | (i >> 1)); @@ -1294,7 +1294,7 @@ operandFromLink (sym_link * type) /* operandFromLit - makes an operand from a literal value */ /*-----------------------------------------------------------------*/ operand * -operandFromLit (float i) +operandFromLit (double i) { return operandFromValue (valueFromLit (i)); } @@ -1407,7 +1407,7 @@ usualUnaryConversions (operand * op) { if (IS_INTEGRAL (operandType (op))) { - if (getSize (operandType (op)) < INTSIZE) + if (getSize (operandType (op)) < (unsigned int) INTSIZE) { /* Widen to int. */ return geniCodeCast (INTTYPE, op, TRUE); @@ -2393,7 +2393,7 @@ geniCodeLogic (operand * left, operand * right, int op) if (IS_INTEGRAL (ltype) && IS_LITERAL (rtype)) { int nbits = bitsForType (ltype); - long v = operandLitValue (right); + long v = (long) operandLitValue (right); if (v > ((LONG_LONG) 1 << nbits) && v > 0) werror (W_CONST_RANGE, " compare operation "); @@ -2489,7 +2489,7 @@ geniCodeAssign (operand * left, operand * right, int nosupdate) if (IS_INTEGRAL (ltype) && right->type == VALUE && IS_LITERAL (rtype)) { int nbits = bitsForType (ltype); - long v = operandLitValue (right); + long v = (long) operandLitValue (right); if (v > ((LONG_LONG) 1 << nbits) && v > 0) werror (W_CONST_RANGE, " = operation"); diff --git a/src/SDCCicode.h b/src/SDCCicode.h index d8d8e31e..d94c8de5 100644 --- a/src/SDCCicode.h +++ b/src/SDCCicode.h @@ -282,7 +282,7 @@ iCodeTable *getTableEntry (int); int isOperandLiteral (operand *); operand *operandOperation (operand *, operand *, int, sym_link *); double operandLitValue (operand *); -operand *operandFromLit (float); +operand *operandFromLit (double); operand *operandFromOperand (operand *); int isParameterToCall (value *, operand *); iCode *newiCodeLabelGoto (int, symbol *); diff --git a/src/SDCCloop.c b/src/SDCCloop.c index 6a5b239f..ca70d4b3 100644 --- a/src/SDCCloop.c +++ b/src/SDCCloop.c @@ -758,8 +758,8 @@ basicInduction (region * loopReg, eBBlock ** ebbs, int count) continue; aSym = (IS_OP_LITERAL (IC_RIGHT (dic)) ? - (litValue = operandLitValue (IC_RIGHT (dic)), IC_LEFT (dic)) : - (litValue = operandLitValue (IC_LEFT (dic)), IC_RIGHT (dic))); + (litValue = (unsigned long) operandLitValue (IC_RIGHT (dic)), IC_LEFT (dic)) : + (litValue = (unsigned long) operandLitValue (IC_LEFT (dic)), IC_RIGHT (dic))); if (!isOperandEqual (IC_RESULT (ic), aSym) && !isOperandEqual (IC_RIGHT (ic), aSym)) @@ -937,8 +937,8 @@ loopInduction (region * loopReg, eBBlock ** ebbs, int count) continue; aSym = (IS_SYMOP (IC_LEFT (ic)) ? - (lr = 1, litVal = operandLitValue (IC_RIGHT (ic)), IC_LEFT (ic)) : - (litVal = operandLitValue (IC_LEFT (ic)), IC_RIGHT (ic))); + (lr = 1, litVal = (unsigned long) operandLitValue (IC_RIGHT (ic)), IC_LEFT (ic)) : + (litVal = (unsigned long) operandLitValue (IC_LEFT (ic)), IC_RIGHT (ic))); ip = NULL; /* check if this is an induction variable */ @@ -947,8 +947,8 @@ loopInduction (region * loopReg, eBBlock ** ebbs, int count) /* ask port for size not worth if native instruction exist for multiply & divide */ - if (getSize (operandType (IC_LEFT (ic))) <= port->muldiv.native_below || - getSize (operandType (IC_RIGHT (ic))) <= port->muldiv.native_below) + if (getSize (operandType (IC_LEFT (ic))) <= (unsigned long) port->muldiv.native_below || + getSize (operandType (IC_RIGHT (ic))) <= (unsigned long) port->muldiv.native_below) continue; /* if this is a division then the remainder should be zero diff --git a/src/SDCCval.h b/src/SDCCval.h index 0ca0de48..17c4ba4a 100644 --- a/src/SDCCval.h +++ b/src/SDCCval.h @@ -89,7 +89,7 @@ value *valCompare (value *, value *, int); value *valBitwise (value *, value *, int); value *valLogicAndOr (value *, value *, int); value *valCastLiteral (sym_link *, double); -value *valueFromLit (float); +value *valueFromLit (double); initList *newiList (int, void *); initList *revinit (initList *); initList *copyIlist (initList *); diff --git a/src/pic/glue.c b/src/pic/glue.c index 8ede432f..767fb3ec 100644 --- a/src/pic/glue.c +++ b/src/pic/glue.c @@ -33,7 +33,7 @@ extern symbol *interrupts[256]; void printIval (symbol *, sym_link *, initList *, FILE *); extern int noAlloc; extern set *publics; -extern int maxInterrupts; +extern unsigned maxInterrupts; extern int maxRegBank; extern symbol *mainf; extern char *VersionString; @@ -806,7 +806,7 @@ pic14emitMaps () static void pic14createInterruptVect (FILE * vFile) { - int i = 0; + unsigned i = 0; mainf = newSymbol ("main", 0); mainf->block = 0; diff --git a/src/port.h b/src/port.h index e0470a8f..0e6459b7 100644 --- a/src/port.h +++ b/src/port.h @@ -148,7 +148,7 @@ typedef struct /** One more than the smallest mul/div operation the processor can do nativley Eg if the processor has an 8 bit mul, nativebelow is 2 */ - int native_below; + unsigned native_below; /** The mul/div/mod functions will be made to use regparams for sizeof(param) < log2(force_reg) i.e. Use 2 for WORD and BYTE, 0 for none. */ -- 2.30.2