bitfll.c 1003 Bytes
#include <rmon.h>
#include "corefunc.h"

bitfll()
{
     	int numFailures = 0;
	unsigned long i = 	0x01010101LU;
	unsigned long long j = 0x20101010aLLU;
	struct rec {
		unsigned f1 : 4;
		unsigned long f2 : 28;
	} vrec;
	struct brec {
		unsigned bf1 : 4;
		unsigned long long bf2 : 60;
		unsigned long long bf3 : 8;
		unsigned long long bf4 : 48;
		unsigned long long bf5 : 8;
	} vbrec;

	vrec.f1 = 3;
	vrec.f2 = i;
	numFailures += check_equal(vrec.f1, 3);
	numFailures += check_equal(vrec.f2, i);
	vbrec.bf1 = 3;
	vbrec.bf2 = j;
	vbrec.bf3 = vbrec.bf1+1;
	vbrec.bf4 = vbrec.bf2;
	vbrec.bf5 = vbrec.bf3;
	numFailures += check_equal(vbrec.bf1, vrec.f1);
	numFailures += check_equal(vbrec.bf2, j);
	numFailures += check_equal(vbrec.bf3, 4);
	numFailures += check_equal(vbrec.bf4, vbrec.bf2);
	numFailures += check_equal(vbrec.bf5, vbrec.bf3);
    	return(numFailures);
}

int 
check_equal (long long a, long long b)
{
	if (a != b) {
		osSyncPrintf("a=%llx b=%llx\n", a, b);
		return(1);
	}
	return(0);
}