/* SccsId = "@(#)define.h 3.1 (TU-Delft) 06/08/90" */
/**********************************************************

Name/Version      : nspice/3.1

Language          : C
Operating system  : UNIX SYSTEM V
Host machine      : HP9000

Author(s)         : A.J. van Genderen
Creation date     : 8-June-1990
Modified by       :
Modification date :


        Delft University of Technology
        Department of Electrical Engineering
        Network Theory Section
        Mekelweg 4 - P.O.Box 5031
        2600 GA DELFT
        The Netherlands

        Phone : 015 - 786234

        COPYRIGHT (C) 1990 , All rights reserved
**********************************************************/

#define MAXTYPE(type)  (~(1<<(8*(int)sizeof(type))-1))
#ifndef MAXINT
#define MAXINT	        MAXTYPE(int)
#endif
#ifndef MAXLONG
#define MAXLONG	        MAXTYPE(long)
#endif

#define Min(a,b)  ((a)<(b)?(a):(b))
#define Max(a,b)  ((a)>(b)?(a):(b))
#define Abs(a)    ((a)>=0?(a):(-(a)))

#define NEW(ptr, nel, type)                                                \
    if ((ptr = (type *)calloc ((unsigned)(nel), sizeof (type))) == NULL) { \
	fprintf (stderr, "Cannot allocate storage\n");                     \
	exit (1);                                                          \
    }

#define DELETE(ptr)       if (ptr) cfree (ptr)

