Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!tdatirv!sarima From: sarima@tdatirv.UUCP (Stanley Friesen) Newsgroups: comp.lang.c++ Subject: Re: 64 bit architectures and C/C++ Message-ID: <226@tdatirv.UUCP> Date: 30 Apr 91 00:35:20 GMT References: <168@shasta.Stanford.EDU> <224@tdatirv.UUCP> <295@dumbcat.sf.ca.us> Reply-To: sarima@tdatirv.UUCP (Stanley Friesen) Organization: Teradata Corp., Irvine Lines: 41 In article <295@dumbcat.sf.ca.us> marc@dumbcat.sf.ca.us (Marco S Hyman) writes: >I hope not -- at least not without some other way of describing a 16-bit >value. 64-bit architecture machines will still have to communicate with other >machines that do support 16-bit values. Swapping bytes between big and little >endian machines is bad enough. Think about the overhead of converting a pair >of bytes to a 16-bit value. Binary communication between machines should use XDR *not* C structures. As for how to do it, see below. >Hmmm. How would such a processor communicate with hardware devices requiring >16-bit I/O? How would a structure that maps an external device's registers be >coded if the registers are 16-bits wide? If there is a way to do these things >then a 16-bit wide data type is probably necessary. Well, two seperate points. First, if the machine does not have 16-bit operations in its instruction set, then 16-bit I/O registers will probably be wired into 32-bit pseudo-words (with the high-order 16-bits wired into the bit-bucket). Remember, the lack of 16-bit instructions would mean that 16-bit bus transfers are not possible. Secondly, there are two possible implementations of this sort of thing. First, C has this concept called bit fields, which can be of any size you want - so if you *must* have a 16-bit quantity, use a 16-bit bit field. (This also answers the previous objection - if you *must* be machine dependent, at least make it stand out). Alternatively, for the I/O register case, just send two sequential bytes. (Unless the machine does not have byte adressing - which is quite possible in a 64-bit super-computer). Remember, binary compatibility between machines is a very shaky proposition at best, so it is better not to depend on it at all. -- --------------- uunet!tdatirv!sarima (Stanley Friesen)