Use uintptr_t/intptr_t when casting between pointer and integer.
The code was using (unsigned) long, but a long is 32-bits in the Windows 64-bit ABI.
This commit is contained in:
parent
9e3f1ef1ff
commit
45dc13e496
|
|
@ -36,7 +36,7 @@ double acc_fetch_paramval(handle object)
|
||||||
fprintf(pli_trace, "acc_fetch_paramval(%s) --> \"%s\"\n",
|
fprintf(pli_trace, "acc_fetch_paramval(%s) --> \"%s\"\n",
|
||||||
vpi_get_str(vpiName, object), val.value.str);
|
vpi_get_str(vpiName, object), val.value.str);
|
||||||
}
|
}
|
||||||
return (double) (long)val.value.str;
|
return (double) (intptr_t)val.value.str;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
vpi_printf("XXXX: parameter %s has type %d\n",
|
vpi_printf("XXXX: parameter %s has type %d\n",
|
||||||
|
|
|
||||||
|
|
@ -1900,7 +1900,7 @@ void emit_signal_net_const_as_ca(ivl_scope_t scope, ivl_signal_t sig)
|
||||||
{
|
{
|
||||||
ivl_nexus_t nex = ivl_signal_nex(sig, 0);
|
ivl_nexus_t nex = ivl_signal_nex(sig, 0);
|
||||||
unsigned idx, count = ivl_nexus_ptrs(nex);
|
unsigned idx, count = ivl_nexus_ptrs(nex);
|
||||||
unsigned long emitted = (unsigned long) ivl_nexus_get_private(nex);
|
unsigned long emitted = (uintptr_t) ivl_nexus_get_private(nex);
|
||||||
for (idx = 0; idx < count; idx += 1) {
|
for (idx = 0; idx < count; idx += 1) {
|
||||||
ivl_nexus_ptr_t nex_ptr = ivl_nexus_ptr(nex, idx);
|
ivl_nexus_ptr_t nex_ptr = ivl_nexus_ptr(nex, idx);
|
||||||
ivl_net_const_t net_const = ivl_nexus_ptr_con(nex_ptr);
|
ivl_net_const_t net_const = ivl_nexus_ptr_con(nex_ptr);
|
||||||
|
|
@ -1930,7 +1930,7 @@ void emit_signal_net_const_as_ca(ivl_scope_t scope, ivl_signal_t sig)
|
||||||
fprintf(vlog_out, "\n");
|
fprintf(vlog_out, "\n");
|
||||||
/* Increment the emitted constant count by one. */
|
/* Increment the emitted constant count by one. */
|
||||||
ivl_nexus_set_private(nex,
|
ivl_nexus_set_private(nex,
|
||||||
(void *) ((unsigned long) ivl_nexus_get_private(nex) + 1U));
|
(void *) ((uintptr_t) ivl_nexus_get_private(nex) + 1U));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* We must find the constant in the nexus. */
|
/* We must find the constant in the nexus. */
|
||||||
|
|
|
||||||
24
vpi/fstapi.c
24
vpi/fstapi.c
|
|
@ -1449,12 +1449,12 @@ for(i=0;i<xc->maxhandle;i++)
|
||||||
PPvoid_t pv = JudyHSIns(&PJHSArray, dmem, destlen, NULL);
|
PPvoid_t pv = JudyHSIns(&PJHSArray, dmem, destlen, NULL);
|
||||||
if(*pv)
|
if(*pv)
|
||||||
{
|
{
|
||||||
uint32_t pvi = (long)(*pv);
|
uint32_t pvi = (intptr_t)(*pv);
|
||||||
vm4ip[2] = -pvi;
|
vm4ip[2] = -pvi;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*pv = (void *)(long)(i+1);
|
*pv = (void *)(intptr_t)(i+1);
|
||||||
#endif
|
#endif
|
||||||
fpos += fstWriterVarint(f, wrlen);
|
fpos += fstWriterVarint(f, wrlen);
|
||||||
fpos += destlen;
|
fpos += destlen;
|
||||||
|
|
@ -1469,12 +1469,12 @@ for(i=0;i<xc->maxhandle;i++)
|
||||||
PPvoid_t pv = JudyHSIns(&PJHSArray, scratchpnt, wrlen, NULL);
|
PPvoid_t pv = JudyHSIns(&PJHSArray, scratchpnt, wrlen, NULL);
|
||||||
if(*pv)
|
if(*pv)
|
||||||
{
|
{
|
||||||
uint32_t pvi = (long)(*pv);
|
uint32_t pvi = (intptr_t)(*pv);
|
||||||
vm4ip[2] = -pvi;
|
vm4ip[2] = -pvi;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*pv = (void *)(long)(i+1);
|
*pv = (void *)(intptr_t)(i+1);
|
||||||
#endif
|
#endif
|
||||||
fpos += fstWriterVarint(f, 0);
|
fpos += fstWriterVarint(f, 0);
|
||||||
fpos += wrlen;
|
fpos += wrlen;
|
||||||
|
|
@ -1504,12 +1504,12 @@ for(i=0;i<xc->maxhandle;i++)
|
||||||
PPvoid_t pv = JudyHSIns(&PJHSArray, dmem, rc, NULL);
|
PPvoid_t pv = JudyHSIns(&PJHSArray, dmem, rc, NULL);
|
||||||
if(*pv)
|
if(*pv)
|
||||||
{
|
{
|
||||||
uint32_t pvi = (long)(*pv);
|
uint32_t pvi = (intptr_t)(*pv);
|
||||||
vm4ip[2] = -pvi;
|
vm4ip[2] = -pvi;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*pv = (void *)(long)(i+1);
|
*pv = (void *)(intptr_t)(i+1);
|
||||||
#endif
|
#endif
|
||||||
fpos += fstWriterVarint(f, wrlen);
|
fpos += fstWriterVarint(f, wrlen);
|
||||||
fpos += rc;
|
fpos += rc;
|
||||||
|
|
@ -1524,12 +1524,12 @@ for(i=0;i<xc->maxhandle;i++)
|
||||||
PPvoid_t pv = JudyHSIns(&PJHSArray, scratchpnt, wrlen, NULL);
|
PPvoid_t pv = JudyHSIns(&PJHSArray, scratchpnt, wrlen, NULL);
|
||||||
if(*pv)
|
if(*pv)
|
||||||
{
|
{
|
||||||
uint32_t pvi = (long)(*pv);
|
uint32_t pvi = (intptr_t)(*pv);
|
||||||
vm4ip[2] = -pvi;
|
vm4ip[2] = -pvi;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*pv = (void *)(long)(i+1);
|
*pv = (void *)(intptr_t)(i+1);
|
||||||
#endif
|
#endif
|
||||||
fpos += fstWriterVarint(f, 0);
|
fpos += fstWriterVarint(f, 0);
|
||||||
fpos += wrlen;
|
fpos += wrlen;
|
||||||
|
|
@ -1546,12 +1546,12 @@ for(i=0;i<xc->maxhandle;i++)
|
||||||
PPvoid_t pv = JudyHSIns(&PJHSArray, scratchpnt, wrlen, NULL);
|
PPvoid_t pv = JudyHSIns(&PJHSArray, scratchpnt, wrlen, NULL);
|
||||||
if(*pv)
|
if(*pv)
|
||||||
{
|
{
|
||||||
uint32_t pvi = (long)(*pv);
|
uint32_t pvi = (intptr_t)(*pv);
|
||||||
vm4ip[2] = -pvi;
|
vm4ip[2] = -pvi;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*pv = (void *)(long)(i+1);
|
*pv = (void *)(intptr_t)(i+1);
|
||||||
#endif
|
#endif
|
||||||
fpos += fstWriterVarint(f, 0);
|
fpos += fstWriterVarint(f, 0);
|
||||||
fpos += wrlen;
|
fpos += wrlen;
|
||||||
|
|
@ -2307,14 +2307,14 @@ if(xc && path && path[0])
|
||||||
PPvoid_t pv = JudyHSIns(&(xc->path_array), path2, slen, NULL);
|
PPvoid_t pv = JudyHSIns(&(xc->path_array), path2, slen, NULL);
|
||||||
if(*pv)
|
if(*pv)
|
||||||
{
|
{
|
||||||
sidx = (long)(*pv);
|
sidx = (intptr_t)(*pv);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char *rp = NULL;
|
char *rp = NULL;
|
||||||
|
|
||||||
sidx = ++xc->path_array_count;
|
sidx = ++xc->path_array_count;
|
||||||
*pv = (void *)(long)(xc->path_array_count);
|
*pv = (void *)(intptr_t)(xc->path_array_count);
|
||||||
|
|
||||||
if(use_realpath)
|
if(use_realpath)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -623,18 +623,18 @@ static void scan_item(unsigned depth, vpiHandle item, int skip)
|
||||||
|
|
||||||
new_ident = fstWriterCreateVar(dump_file, type,
|
new_ident = fstWriterCreateVar(dump_file, type,
|
||||||
dir, size, buf,
|
dir, size, buf,
|
||||||
(fstHandle)(long)ident);
|
(fstHandle)(intptr_t)ident);
|
||||||
free(buf);
|
free(buf);
|
||||||
} else {
|
} else {
|
||||||
new_ident = fstWriterCreateVar(dump_file, type,
|
new_ident = fstWriterCreateVar(dump_file, type,
|
||||||
dir, size, escname,
|
dir, size, escname,
|
||||||
(fstHandle)(long)ident);
|
(fstHandle)(intptr_t)ident);
|
||||||
}
|
}
|
||||||
free(escname);
|
free(escname);
|
||||||
|
|
||||||
if (!ident) {
|
if (!ident) {
|
||||||
if (nexus_id) set_nexus_ident(nexus_id,
|
if (nexus_id) set_nexus_ident(nexus_id,
|
||||||
(const char *)(long)new_ident);
|
(const char *)(intptr_t)new_ident);
|
||||||
|
|
||||||
/* Add a callback for the signal. */
|
/* Add a callback for the signal. */
|
||||||
info = malloc(sizeof(*info));
|
info = malloc(sizeof(*info));
|
||||||
|
|
|
||||||
|
|
@ -580,7 +580,7 @@ static int signal_get(int code, vpiHandle ref)
|
||||||
// This private property must return zero when undefined.
|
// This private property must return zero when undefined.
|
||||||
case _vpiNexusId:
|
case _vpiNexusId:
|
||||||
if (rfp->msb.get_value() == rfp->lsb.get_value())
|
if (rfp->msb.get_value() == rfp->lsb.get_value())
|
||||||
return (int) (unsigned long) rfp->node;
|
return (int) (uintptr_t) rfp->node;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1039,7 +1039,7 @@ template <class T> class vvp_sub_pointer_t {
|
||||||
|
|
||||||
vvp_sub_pointer_t(T*ptr__, unsigned port__)
|
vvp_sub_pointer_t(T*ptr__, unsigned port__)
|
||||||
{
|
{
|
||||||
bits_ = reinterpret_cast<unsigned long> (ptr__);
|
bits_ = reinterpret_cast<uintptr_t> (ptr__);
|
||||||
assert( (bits_ & 3) == 0 );
|
assert( (bits_ & 3) == 0 );
|
||||||
assert( (port__ & ~3) == 0 );
|
assert( (port__ & ~3) == 0 );
|
||||||
bits_ |= port__;
|
bits_ |= port__;
|
||||||
|
|
@ -1061,7 +1061,7 @@ template <class T> class vvp_sub_pointer_t {
|
||||||
bool operator != (vvp_sub_pointer_t that) const { return bits_ != that.bits_; }
|
bool operator != (vvp_sub_pointer_t that) const { return bits_ != that.bits_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned long bits_;
|
uintptr_t bits_;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef vvp_sub_pointer_t<vvp_net_t> vvp_net_ptr_t;
|
typedef vvp_sub_pointer_t<vvp_net_t> vvp_net_ptr_t;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue