remove compilation warnings (type casts)

This commit is contained in:
Francesco Lannutti 2012-10-26 18:04:44 +02:00
parent d8b2ac56a3
commit 1dc70189a7
8 changed files with 18 additions and 20 deletions

View File

@ -365,7 +365,7 @@ nadd(SPICE_DSTRINGPTR dstr_p, long n)
} }
while (n > 0) { while (n > 0) {
d[k] = n % 10; d[k] = (int)(n % 10);
k++; k++;
n = n / 10; n = n / 10;
} }

View File

@ -1066,11 +1066,11 @@ operate(char op, double x, double y)
x = z; x = z;
break; break;
case '%': /* % */ case '%': /* % */
t = np_trunc(x / y); t = (double)(np_trunc(x / y));
x = x - y * t; x = x - y * t;
break; break;
case '\\': /* / */ case '\\': /* / */
x = np_trunc(absf(x / y)); x = (double)(np_trunc(absf(x / y)));
break; break;
} }

View File

@ -86,7 +86,7 @@ void checkseed(void)
/* printf("Enter checkseed()\n"); */ /* printf("Enter checkseed()\n"); */
if (cp_getvar("rndseed", CP_NUM, &newseed)) { if (cp_getvar("rndseed", CP_NUM, &newseed)) {
if ((newseed > 0) && (oldseed != newseed)) { if ((newseed > 0) && (oldseed != newseed)) {
srand(newseed); srand((unsigned int)newseed);
TausSeed(); TausSeed();
oldseed = newseed; oldseed = newseed;
printf("Seed value for random number generator is set to %d\n", newseed); printf("Seed value for random number generator is set to %d\n", newseed);
@ -173,13 +173,13 @@ float CombLCGTaus2(void)
{ {
unsigned long b; unsigned long b;
b = (((CombState1 << 13) ^ CombState1) >> 19); b = (((CombState1 << 13) ^ CombState1) >> 19);
CombState1 = (((CombState1 & 4294967294UL) << 12) ^ b); CombState1 = (unsigned int)(((CombState1 & 4294967294UL) << 12) ^ b);
b = (((CombState2 << 2) ^ CombState2) >> 25); b = (((CombState2 << 2) ^ CombState2) >> 25);
CombState2 = (((CombState2 & 4294967288UL) << 4) ^ b); CombState2 = (unsigned int)(((CombState2 & 4294967288UL) << 4) ^ b);
b = (((CombState3 << 3) ^ CombState3) >> 11); b = (((CombState3 << 3) ^ CombState3) >> 11);
CombState3 = (((CombState3 & 4294967280UL) << 17) ^ b); CombState3 = (unsigned int)(((CombState3 & 4294967280UL) << 17) ^ b);
CombState4 = (1664525 * CombState4 + 1013904223UL); CombState4 = (unsigned int)(1664525 * CombState4 + 1013904223UL);
return ((CombState1 ^ CombState2 ^ CombState3 ^ CombState4) * 2.3283064365387e-10f); return ((float)(CombState1 ^ CombState2 ^ CombState3 ^ CombState4) * 2.3283064365387e-10f);
} }
@ -187,12 +187,12 @@ unsigned int CombLCGTausInt2(void)
{ {
unsigned long b; unsigned long b;
b = (((CombState5 << 13) ^ CombState5) >> 19); b = (((CombState5 << 13) ^ CombState5) >> 19);
CombState5 = (((CombState5 & 4294967294UL) << 12) ^ b); CombState5 = (unsigned int)(((CombState5 & 4294967294UL) << 12) ^ b);
b = (((CombState6 << 2) ^ CombState6) >> 25); b = (((CombState6 << 2) ^ CombState6) >> 25);
CombState6 = (((CombState6 & 4294967288UL) << 4) ^ b); CombState6 = (unsigned int)(((CombState6 & 4294967288UL) << 4) ^ b);
b = (((CombState7 << 3) ^ CombState7) >> 11); b = (((CombState7 << 3) ^ CombState7) >> 11);
CombState7 = (((CombState7 & 4294967280UL) << 17) ^ b); CombState7 = (unsigned int)(((CombState7 & 4294967280UL) << 17) ^ b);
CombState8 = (1664525 * CombState8 + 1013904223UL); CombState8 = (unsigned int)(1664525 * CombState8 + 1013904223UL);
return (CombState5 ^ CombState6 ^ CombState7 ^ CombState8); return (CombState5 ^ CombState6 ^ CombState7 ^ CombState8);
} }

View File

@ -916,7 +916,7 @@ void nghash_distribution(NGHASHPTR hashtable)
if( this_count > 0 ){ if( this_count > 0 ){
nzero_cnt++ ; nzero_cnt++ ;
} }
diff = this_count - avg ; diff = (double)this_count - avg ;
diff2 = diff * diff ; diff2 = diff * diff ;
sum2 += diff2 ; sum2 += diff2 ;
} }

View File

@ -93,8 +93,6 @@ evt_dest(Evt_Ckt_Data_t *evt)
Evt_Node_Info_t **node_table; Evt_Node_Info_t **node_table;
Evt_Port_Info_t **port_table; Evt_Port_Info_t **port_table;
Evt_Inst_Index_t *inst_list;
Evt_State_Data_t *state_data; Evt_State_Data_t *state_data;
Evt_State_t *statenext, *state; Evt_State_t *statenext, *state;

View File

@ -337,7 +337,7 @@ INoi1 1 0 DC 0 TRNOISE(0n 0.5n 1 10n) : generate 1/f noise
double V1 = trnoise_state_get(state, ckt, n1); double V1 = trnoise_state_get(state, ckt, n1);
double V2 = trnoise_state_get(state, ckt, n1+1); double V2 = trnoise_state_get(state, ckt, n1+1);
value = V1 + (V2 - V1) * (time / TS - n1); value = V1 + (V2 - V1) * (time / TS - (double)n1);
} }
/* RTS noise */ /* RTS noise */

View File

@ -355,7 +355,7 @@ VNoi3 3 0 DC 0 TRNOISE(0 0 0 0 15m 22u 50u) : generate RTS noise
double V1 = trnoise_state_get(state, ckt, n1); double V1 = trnoise_state_get(state, ckt, n1);
double V2 = trnoise_state_get(state, ckt, n1+1); double V2 = trnoise_state_get(state, ckt, n1+1);
value = V1 + (V2 - V1) * (time / TS - n1); value = V1 + (V2 - V1) * (time / TS - (double)n1);
} }
/* RTS noise */ /* RTS noise */

View File

@ -161,7 +161,7 @@ card *current ) /* the card we are to parse */
char *name; /* the name of the instance */ char *name; /* the name of the instance */
char *model=NULL; /* the name of the model */ char *model=NULL; /* the name of the model */
char *def_port_type_str; /* The default port type in string form */ char *def_port_type_str = NULL; /* The default port type in string form */
char *next_token; /* a token string */ char *next_token; /* a token string */
char *tmp_token; /* a token string */ char *tmp_token; /* a token string */
@ -178,7 +178,7 @@ card *current ) /* the card we are to parse */
Mif_Conn_Info_t *conn_info; /* for faster access to conn info struct */ Mif_Conn_Info_t *conn_info; /* for faster access to conn info struct */
Mif_Param_Info_t *param_info; /* for faster access to param info struct */ Mif_Param_Info_t *param_info; /* for faster access to param info struct */
Mif_Port_Type_t def_port_type; /* the default port type */ Mif_Port_Type_t def_port_type = 0; /* the default port type */
Mif_Status_t status; /* return status */ Mif_Status_t status; /* return status */
Mif_Token_Type_t next_token_type; /* the type of the next token */ Mif_Token_Type_t next_token_type; /* the type of the next token */