Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!sundc!netxcom!hadron!jsdy From: jsdy@hadron.UUCP (Joseph S. D. Yao) Newsgroups: comp.lang.c Subject: Re: bit patterns of all ones Message-ID: <406@hadron.UUCP> Date: Fri, 2-Jan-87 07:31:56 EST Article-I.D.: hadron.406 Posted: Fri Jan 2 07:31:56 1987 Date-Received: Fri, 2-Jan-87 20:59:36 EST References: <1382@hoptoad.uucp> <690001@hplsla.HP.COM> <1527@hoptoad.uucp> <595@mrstve.UUCP> Reply-To: jsdy@hadron.UUCP (Joseph S. D. Yao) Organization: Hadron, Inc., Fairfax, VA Lines: 14 Summary: Casts convert. 2^n-1 is (typically) all ones. In article <595@mrstve.UUCP> rjk@mrstve.UUCP (Richard Kuhns) writes: >I don't understand. On a ones-complement machine, -1 is represented by >11111110(binary) = -1 (decimal, ones complement, signed) >If the ... value above is cast to unsigned, we end up with 254(decimal). Casts convert. "The value is the least unsigned integer congruent to the signed integer (modulo 2^wordsize)." -C REF 6.5, Unsigned. Casts do not necessarily maintain the same bit pattern. [inews placater] -- Joe Yao hadron!jsdy@seismo.{CSS.GOV,ARPA,UUCP} jsdy@hadron.COM (not yet domainised)