Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!asuvax!ncar!gatech!hubcap!fpst From: andy@research.canon.oz.au (Andy Newman) Newsgroups: comp.parallel Subject: Byte order in tight coupled systems. Message-ID: <1991Jun18.173855.29052@hubcap.clemson.edu> Date: 17 Jun 91 21:20:28 GMT Sender: fpst@hubcap.clemson.edu (Steve Stevenson) Organization: Clemson University Lines: 29 Approved: parallel@hubcap.clemson.edu We have a rather interesting problem with a system we are putting together and were wondering if others had any experience with any similar situations. Basically we have a tightly coupled (i.e., shared memory) system with two processors, one little-endian, the other big-endian. We were going to fix it in hardware but that didn't work as expected so its up to us software people to attack it. The system transfer *lots* of complex data structures between the two processors (mainly in one direction, big-endian to little-endian). There's certainly no problem in providing some macros that read and write different primitive types but this is a little low level. We thought about having macros that check the size of an object and apply the appropriate byte swapping (yes this can be fooled with certain structures) but weren't impressed with the possibility of side effects and the great risk of people making mistakes at 2am in the morning. We thought about a pre-processor that would do the necessary magic but in the general case you have to parse C properly and understand type declarations. We could limit what is legal to simplify things but we'd rather not. Before we do anything ourselves has anyone developed any tools for dealing with this sort of situation? Any ideas would be appreciated. -- Andy Newman (andy@research.canon.oz.au)