Fix underflow when UDP has 1 input.

This commit is contained in:
steve 2001-04-24 03:48:53 +00:00
parent 46e868d313
commit ae23a8f6bf
2 changed files with 12 additions and 3 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: compile.cc,v 1.39 2001/04/24 02:23:59 steve Exp $"
#ident "$Id: compile.cc,v 1.40 2001/04/24 03:48:53 steve Exp $"
#endif
# include "compile.h"
@ -319,7 +319,7 @@ void compile_udp_functor(char*label, char*type,
struct vvp_udp_s *u = udp_find(type);
assert (argc == u->nin);
int nfun = (argc-2) / 3 + 1;
int nfun = argc<=4 ? 1 : (argc-2) / 3 + 1;
vvp_ipoint_t fdx = functor_allocate(nfun);
functor_t obj = functor_index(fdx);
@ -944,6 +944,9 @@ void compile_dump(FILE*fd)
/*
* $Log: compile.cc,v $
* Revision 1.40 2001/04/24 03:48:53 steve
* Fix underflow when UDP has 1 input.
*
* Revision 1.39 2001/04/24 02:23:59 steve
* Support for UDP devices in VVP (Stephen Boettcher)
*

View File

@ -20,7 +20,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: udp.h,v 1.1 2001/04/24 02:23:59 steve Exp $"
#ident "$Id: udp.h,v 1.2 2001/04/24 03:48:53 steve Exp $"
#endif
#include "pointers.h"
@ -109,6 +109,9 @@ inline vvp_ipoint_t udp_idx_t::next_node()
inline vvp_ipoint_t udp_idx_t::parent()
{
if (nin<=4)
return 0x0;
int idx = (cur_i==nin-1 ? cur_i-1 : cur_i) / 3;
if (!idx)
return 0x0;
@ -117,6 +120,9 @@ inline vvp_ipoint_t udp_idx_t::parent()
/*
* $Log: udp.h,v $
* Revision 1.2 2001/04/24 03:48:53 steve
* Fix underflow when UDP has 1 input.
*
* Revision 1.1 2001/04/24 02:23:59 steve
* Support for UDP devices in VVP (Stephen Boettcher)
*