#ifndef _param_H
#define _param_H
/************************************************************************/
/* Copyright 1990 MBARI                                                 */
/************************************************************************/

/************************************************************************/
/* Summary  : System Parameter Declarations                             */
/* Filename : param.h                                                   */
/* Author   : Bob Herlien (rah)                                         */
/* Project  :                                                           */
/* Version  : Version 1.0                                               */
/* Created  : 03/07/90                                                  */
/* Modified : 03/08/90                                                  */
/* Archived :                                                           */
/************************************************************************/
/* Modification History:                                                */
/* 07mar90 rah - created from <sys/param.h>                             */
/************************************************************************/

#ifndef INCparamh
#define INCparamh       1

#include        <mbariTypes.h>


/*
 * fundamental constants of the CPU
 * cannot be changed easily
 */

#ifndef NBBY
#define NBBY    8               /* number of bits in a byte     */
#endif /* NBBY */

#define NBPW    sizeof(int)     /* number of bytes in an integer */
#define NBTSPW  (NBBY*NBPW)     /* number of bits in an integer */

#define NBPINT16        (sizeof(Int16)) /* number of bytes per Int16    */
#define NBTSPINT16      (NBBY*NBPINT16) /* number of bits per Int16     */

#define NBPINT32        (sizeof(Int32)) /* number of bytes per Int32    */
#define NBTSPINT32      (NBBY*NBPINT32) /* number of bits per Int32     */

#ifndef NULL
#define NULL    (char *)0
#endif

#define lobyte(X)       (((unsigned char *)&X)[1])
#define hibyte(X)       (((unsigned char *)&X)[0])
#define loword(X)       (((ushort *)&X)[1])
#define hiword(X)       (((ushort *)&X)[0])


/*
 * bit map related macros done on a word basis
 */
#define setbit(a,i)     ((a)[(i)/NBTSPW] |= 1<<((i)%NBTSPW))
#define clrbit(a,i)     ((a)[(i)/NBTSPW] &= ~(1<<((i)%NBTSPW)))
#define isset(a,i)      ((a)[(i)/NBTSPW] & (1<<((i)%NBTSPW)))
#define isclr(a,i)      (((a)[(i)/NBTSPW] & (1<<((i)%NBTSPW))) == 0)

/*
 * bit map related macros done on a byte basis
 */
#define bsetbit(a,i)    ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
#define bclrbit(a,i)    ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
#define bisset(a,i)     ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
#define bisclr(a,i)     (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)


/*
 * Macros for fast min/max.
 */
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))

/*
 * Macros for counting and rounding.
 */
/* #define      howmany(x, y)   (((x)+((y)-1))/(y))     in vxTypesOld.h */
#define roundup(x, y)   ((((x)+((y)-1))/(y))*(y))

#endif /* INCparamh     */
#endif /* _param_H */
