Move /var/svc/log to /var/log/svc
[unleashed/lotheac.git] / usr / src / cmd / ipf / lib / common / fill6bits.c
blob421a07515a4aedca7db9210a845114247b87612f
1 /*
2 * Copyright (C) 1993-2001 by Darren Reed.
4 * See the IPFILTER.LICENCE file for details on licencing.
6 * $Id: fill6bits.c,v 1.5 2002/03/27 15:09:57 darrenr Exp $
7 */
9 #include "ipf.h"
12 void fill6bits(bits, msk)
13 int bits;
14 u_int *msk;
16 if (bits == 0) {
17 msk[0] = 0;
18 msk[1] = 0;
19 msk[2] = 0;
20 msk[3] = 0;
21 return;
24 msk[0] = 0xffffffff;
25 msk[1] = 0xffffffff;
26 msk[2] = 0xffffffff;
27 msk[3] = 0xffffffff;
29 if (bits == 128)
30 return;
31 if (bits > 96) {
32 msk[3] = htonl(msk[3] << (128 - bits));
33 } else if (bits > 64) {
34 msk[3] = 0;
35 msk[2] = htonl(msk[2] << (96 - bits));
36 } else if (bits > 32) {
37 msk[3] = 0;
38 msk[2] = 0;
39 msk[1] = htonl(msk[1] << (64 - bits));
40 } else {
41 msk[3] = 0;
42 msk[2] = 0;
43 msk[1] = 0;
44 msk[0] = htonl(msk[0] << (32 - bits));