Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!decvax!duke!mcnc!idis!george From: george@idis.UUCP (George Rosenberg) Newsgroups: net.lang.c,net.arch Subject: Re: One"s complement machines and C logic Message-ID: <244@idis.UUCP> Date: Sun, 29-Jan-84 14:17:07 EST Article-I.D.: idis.244 Posted: Sun Jan 29 14:17:07 1984 Date-Received: Thu, 9-Feb-84 03:12:26 EST References: u1100a.537 Lines: 33 If CSO already has UNIX (and presumably a C compiler) working on their one's complement machine (Sperry 1100), then it would seem that the one's complement arithmetic problem has already been successfully addressed. Of course you may on occasion be confronted with a non-portable construct in an existing program, but that problem is not specific to one's complement arithmetic. One way of dealing with one's complement hardware is for the C compiler to normalize the results of arithmetic expressions (i.e. change "~0" to "0"). Since "~0" can no longer be the result of an arithmetic expression, the expression "0 == ~0" would evaluate to "0" (i.e. false). Similarly, "~0" would be true. Below are arithmetic expressions (in the preceding sense). -e e+e e+=e ++e e-e e-=e --e e*e e*=e e++ e/e e/=e e-- e%e e%=e A second way of dealing with one's complement hardware is for the C compiler to use a two's complement representation. It would simulate two's complement behavior with several one's complement instructions. George Rosenberg idis!george