This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: big-endian for Pentium Pro


On Thu, 18 Jun 1998, Ulf Meerwald wrote:

> Is someone working on the big-endian-r/w for Pentiums,..?

Why can't you just shuffle the bytes?  You don't want to shuffle all the
bytes - so work out what's in big and what's in little endian, and
shuffle:

long freadbelong(FILE* f) {
	long tmp, out;
	fread(&tmp, 4, 1, f);
	out = tmp >> 24;
	out += (tmp >> 16) & 0xff;
	out += (tmp >> 8) & 0xff;
	out += tmp & 0xff;
	return out;
}

I think there are macros in the kernel for this.

njh



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]