Hal Murray <hmur...@megapathdsl.net>: > > strom...@nexgo.de said: > > Does anybody know of an implementation that does _not_ preserve the > > representation when converting from signed to unsigned integer of the same > > width? The assumptions already made are: Corresponding signed and unsigned > > representation have the same number of bits, signed uses 2's complement > > representation, there are no extraordinary values and no padding bits in the > > representation. > > I think all modern machines are using 2s complement arithmetic. > > 50 years ago, a few systems used signed-magnitude and 1s complement. > > That "implementation dependent" sort of weasel wording is probably > left over to cover that case. It might actually get interesting if > somebody ported a modern c compiler to work on one of those older > systems or an emulation of one.
To my utter, gob-smacked astonishment, it turns out this is still a live issue. Though, thankfully, not for us. I thought I could just mumble something about the CDC 6600 and be done, but if you google "one's-complement machines" you'll find that Unisys still ships a series of machines with the brand "Clear-Path Dorado" (latest variant introduced 2015) that are emulations of their old 1100-series mainframes running over Intel Xeon hardware - and these have one's-complement arithmetic. This isn't a practical port blocker for us, as NTP will never run over the batch OS on these things - it's about as POSIX-compatible as the Bhagavad-Gita. It's just weird and interesting that one's complement machines survive in any form at all. And a bit personal for me. My father was a programmer at Univac in the 1950s and early '60s. He was proud of his work. My very first interaction with a computer ever was getting to play a very primitive game on the oscilloscope-based video console of a Univac 1108. This was in 1968. I was 11 years old, and my game machine cost $8M and took up the entire ground floor of an office building in Rome. Other than the 1100, the one's-complement machines Wikipedia mentions (LINC, PDP-1, and CDC6600) are indeed all long dead. There was a one's-complement "CDC Cyber 18" as late as the 1980s, but again this was never going to implement POSIX. There's a comp.lang.std.c article from 1993 that argues in some technical detail that that a C compiler is not practical on one's-complement hardware because too many C idioms have 2's-complement assumptions baked in: https://groups.google.com/forum/#!topic/comp.std.c/GlZeSxBnCW0 I think I believe this. -- <a href="http://www.catb.org/~esr/">Eric S. Raymond</a> Please consider contributing to my Patreon page at https://www.patreon.com/esr so I can keep the invisible wheels of the Internet turning. Give generously - the civilization you save might be your own. _______________________________________________ devel mailing list devel@ntpsec.org http://lists.ntpsec.org/mailman/listinfo/devel