/* calculate the asn1 bitstring length of the xdr_netobject  */
void asn1_bitstring_len(struct xdr_netobj *in, int *enclen, int *zerobits)
/* calculate the asn1 bitstring length of the xdr_netobject  */
void asn1_bitstring_len(struct xdr_netobj *in, int *enclen, int *zerobits)
{
	int i, zbit = 0,elen = in->len;
	char *ptr;
	ptr = &in->data[in->len -1];
	for(i = in->len; i > 0; i--) {
		if (*ptr == 0) {
			ptr--;
			elen--;
		} else
			break;
	}
	ptr = &in->data[elen - 1];
	for(i = 0; i < 8; i++) {
		short mask = 0x01;
		if (!((mask << i) & *ptr))
			zbit++;
		else
			break;
	}
	*enclen = elen;
	*zerobits = zbit;
}