[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Porting xtl to DEC Alpha



José,

Having fought off an attack of flu, I have now tweaked the xtl headers so that I
can now run compile (with gcc-2.95.2) and run the "xdr" program in the
examples/tests directory.

The code now compiles successfully on both linux and non-linux boxes.
Ie, I've resolved the problems with 
#include <endian.h>
#include <byteswap.h>
that are linux-specific.

The code "xdr" now returns PASSED on completion. (Previously, it FAILED.)
In getting it to do so on the Alpha, I tracked down a bug in <byteswap.h> on
Alpha's.

I have resolved almost all of the unaligned access errors I was getting before.
Some still remain, however. I'm trying to track these down. In the meantime, I
have two quick questions:

1. The code fragment below (output_simple()) suggests that "bool" is cast
to an "int" for storage in the xtl character string. Am I right? 

2. What does the !! in input_simple() mean? I can find no reference to it in my
books. Is it not a double-negative?

Best wishes,
Angus

template <class Buffer>
class XDR_format: public generic_format<Buffer> {
	...
 	void input_simple(bool& data)
		{data=!!XDR_format_bswap_l((char*)require(4));}

 	void output_simple(bool const& data)
		{XDR_format_bswap_l(data?1:0, (char*)require(4));}
	...
}