M_32_SWAP(bo->pgno);
__db_convert(pg, pp, pagesize, pgin)	db_pgno_t pg;	void *pp;	size_t pagesize;	int pgin;{	BINTERNAL *bi;	BKEYDATA *bk;	BOVERFLOW *bo;	PAGE *h;	RINTERNAL *ri;	db_indx_t i, len, tmp;	u_int8_t *p, *end;	COMPQUIET(pg, 0);	h = pp;	if (pgin) {		M_32_SWAP(h->lsn.file);		M_32_SWAP(h->lsn.offset);		M_32_SWAP(h->pgno);		M_32_SWAP(h->prev_pgno);		M_32_SWAP(h->next_pgno);		M_16_SWAP(h->entries);		M_16_SWAP(h->hf_offset);	}	switch (h->type) {	case P_HASH:		for (i = 0; i < NUM_ENT(h); i++) {			if (pgin)				M_16_SWAP(h->inp[i]);			switch (HPAGE_TYPE(h, i)) {			case H_KEYDATA:				break;			case H_DUPLICATE:				len = LEN_HKEYDATA(h, pagesize, i);				p = HKEYDATA_DATA(P_ENTRY(h, i));				for (end = p + len; p < end;) {					if (pgin) {						P_16_SWAP(p);						memcpy(&tmp,						    p, sizeof(db_indx_t));						p += sizeof(db_indx_t);					} else {						memcpy(&tmp,						    p, sizeof(db_indx_t));						SWAP16(p);					}					p += tmp;					SWAP16(p);				}				break;			case H_OFFDUP:				p = HOFFPAGE_PGNO(P_ENTRY(h, i));				SWAP32(p);			/* pgno */				break;			case H_OFFPAGE:				p = HOFFPAGE_PGNO(P_ENTRY(h, i));				SWAP32(p);			/* pgno */				SWAP32(p);			/* tlen */				break;			}		}		if (!pgin)			for (i = 0; i < NUM_ENT(h); i++)				M_16_SWAP(h->inp[i]);		break;	case P_LBTREE:	case P_LRECNO:	case P_DUPLICATE:		for (i = 0; i < NUM_ENT(h); i++) {			if (pgin)				M_16_SWAP(h->inp[i]);			bk = GET_BKEYDATA(h, i);			switch (B_TYPE(bk->type)) {			case B_KEYDATA:				M_16_SWAP(bk->len);				break;			case B_DUPLICATE:			case B_OVERFLOW:				bo = (BOVERFLOW *)bk;				M_32_SWAP(bo->tlen);				M_32_SWAP(bo->pgno);				break;			}			if (!pgin)				M_16_SWAP(h->inp[i]);		}		break;	case P_IBTREE:		for (i = 0; i < NUM_ENT(h); i++) {			if (pgin)				M_16_SWAP(h->inp[i]);			bi = GET_BINTERNAL(h, i);			switch (B_TYPE(bi->type)) {			case B_KEYDATA:				M_16_SWAP(bi->len);				M_32_SWAP(bi->pgno);				M_32_SWAP(bi->nrecs);				break;			case B_DUPLICATE:			case B_OVERFLOW:				bo = (BOVERFLOW *)bi;				M_32_SWAP(bo->tlen);				M_32_SWAP(bo->pgno);				break;			}			if (!pgin)				M_16_SWAP(h->inp[i]);		}		break;	case P_IRECNO:		for (i = 0; i < NUM_ENT(h); i++) {			if (pgin)				M_16_SWAP(h->inp[i]);			ri = GET_RINTERNAL(h, i);			M_32_SWAP(ri->pgno);			M_32_SWAP(ri->nrecs);			if (!pgin)				M_16_SWAP(h->inp[i]);		}	case P_OVERFLOW:	case P_INVALID:		/* Nothing to do. */		break;	default:		return (EINVAL);	}	if (!pgin) {		/* Swap the header information. */		M_32_SWAP(h->lsn.file);		M_32_SWAP(h->lsn.offset);		M_32_SWAP(h->pgno);		M_32_SWAP(h->prev_pgno);		M_32_SWAP(h->next_pgno);		M_16_SWAP(h->entries);		M_16_SWAP(h->hf_offset);	}	return (0);}