9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* botch on long long byte order
@ 1995-09-06 22:32 Steve
  0 siblings, 0 replies; only message in thread
From: Steve @ 1995-09-06 22:32 UTC (permalink / raw)


Order of elements in Length union is incorrect:

:Program to demonstrate:
-------------
#include <u.h>
#include <libc.h>

Length l;

void main(int argc, char *argv[]) {
	USED(argc, argv);

	l.length = 1; 
	l.hlength=0;

	print("should be 1 is %lld\n", l.vlength);

	l.hlength = 1;
	l.length = 0;
	print("should be 0x100000000 is %ullx\n", l.vlength);

	l.vlength = 1;

	print("should be 1 (0/1) is %lld (%ld/%ld)\n",
	      l.vlength, l.hlength, l.length);
}

: I get
-------------
should be 1 is 4294967296
should be 0x100000000 is 1
should be 1 (0/1) is 1 (1/0)
-------------

WARNING: putting them in the correct order (/386/include/u.h)
will mean rebuilding the world though since the file system is byte
order independant, the disk does not need to be reloaded.






^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1995-09-06 22:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-09-06 22:32 botch on long long byte order Steve

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).