/* 
 * $RCSfile: blast_mask32.h,v $
 *
 * x-kernel v3.3
 *
 * Copyright (c) 1993,1991,1990,1996  Arizona Board of Regents
 *
 * $Log: blast_mask32.h,v $
 * Revision 1.2  1996/01/29 22:05:20  slm
 * Updated copyright and version.
 *
 * Revision 1.1  1995/07/28  22:08:26  slm
 * Initial revision
 *
 * Revision 1.8.1.2  1994/12/02  18:08:02  hkaram
 * Xkernelized decl of BlastMask components
 *
 * Revision 1.8.1.1  1994/11/23  17:29:02  hkaram
 * New branch
 *
 * Revision 1.8  1994/01/24  17:48:12  menze
 * Modifications from UMass:
 *
 *   [ 93/08/16          nahum ]
 *   Got rid of annoying #endif warning
 */

/* 
 * Header file for using 32-bit masks
 */

#ifndef blast_mask32_h
#define blast_mask32_h
 
/* 
 * non-ANSI compilers gripe about the _n##U usage while GCC gives
 * warning messages about the u_long cast.
 */
#ifdef __STDC__
#   define UNSIGNED(_n)	_n##U
#else
#   define UNSIGNED(_n)	((xk_u_int32)(_n))
#endif

typedef xk_u_int32	BlastMask;
#define BLAST_MASK_PROTOTYPE	BlastMask

#define BLAST_MAX_FRAGS	32
#define BLAST_FULL_MASK(_m, _n)		(_m) = ( UNSIGNED(0xffffffff) >> (32 - (_n)) )
#define BLAST_MASK_SHIFT_LEFT(_m, _n)	(_m) <<= (_n)
#define BLAST_MASK_SHIFT_RIGHT(_m, _n)	(_m) >>= (_n)
#define BLAST_MASK_IS_BIT_SET(_m, _n)	( *(_m) & ( 1 << ((_n)-1 ) ) )
#define BLAST_MASK_SET_BIT(_m, _n)	( *(_m) |= ( 1 << ((_n)-1) ) )
#define BLAST_MASK_CLEAR(_m)		(_m) = 0
#define BLAST_MASK_IS_ZERO(_m)		( (_m) == 0 )
#define BLAST_MASK_OR(_m1, _m2)		(_m1) |= (_m2)
#define BLAST_MASK_EQ(_m1, _m2)		( (_m1) == (_m2) )
#define BLAST_MASK_NTOH(_tar, _src)	(_tar) = ntohl(_src);
#define BLAST_MASK_HTON(_tar, _src)	(_tar) = htonl(_src);

#define BLAST_PADDING	1

#endif /* ! blast_mask32_h */

