Browse Source

remove compilation warnings (type casts)

Francesco Lannutti 14 years ago
parent
commit
1dc70189a7
  1. 2
      src/frontend/numparam/mystring.c
  2. 4
      src/frontend/numparam/xpressn.c
  3. 20
      src/maths/misc/randnumb.c
  4. 2
      src/misc/hash.c
  5. 2
      src/spicelib/analysis/cktdest.c
  6. 2
      src/spicelib/devices/isrc/isrcload.c
  7. 2
      src/spicelib/devices/vsrc/vsrcload.c
  8. 4
      src/xspice/mif/mif_inp2.c

2
src/frontend/numparam/mystring.c

@ -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;
} }

4
src/frontend/numparam/xpressn.c

@ -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;
} }

20
src/maths/misc/randnumb.c

@ -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);
CombState4 = (1664525 * CombState4 + 1013904223UL);
return ((CombState1 ^ CombState2 ^ CombState3 ^ CombState4) * 2.3283064365387e-10f);
CombState3 = (unsigned int)(((CombState3 & 4294967280UL) << 17) ^ b);
CombState4 = (unsigned int)(1664525 * CombState4 + 1013904223UL);
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);
CombState8 = (1664525 * CombState8 + 1013904223UL);
CombState7 = (unsigned int)(((CombState7 & 4294967280UL) << 17) ^ b);
CombState8 = (unsigned int)(1664525 * CombState8 + 1013904223UL);
return (CombState5 ^ CombState6 ^ CombState7 ^ CombState8); return (CombState5 ^ CombState6 ^ CombState7 ^ CombState8);
} }

2
src/misc/hash.c

@ -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 ;
} }

2
src/spicelib/analysis/cktdest.c

@ -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;

2
src/spicelib/devices/isrc/isrcload.c

@ -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 */

2
src/spicelib/devices/vsrc/vsrcload.c

@ -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 */

4
src/xspice/mif/mif_inp2.c

@ -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 */

Loading…
Cancel
Save