TIP: Click on subject to list as thread! ANSI
echo: locsysop
to: Bob Lawrence
from: Paul Edwards
date: 1996-09-25 07:09:22
subject: Public Domain Pascal

PE> Well, on a signed-magnitude computer, the hardware
PE> manufacturers may have provided a shift-right which preserves
PE> the sign, so that -16 shifted 1 bit to the right becomes -8. It
PE> may make a lot of sense.

BL> Whaaat? How does the machine know it's a signed integer? It's just
BL> 32-bits in a register. Are you telling me that computer hardware has a
BL> list of ints, longints, char, words, arrays, and all that crap?

No, what it actually has (potentially, anyway) is a list of instructions
that assume the 32-bits represent a signed integer, or an unsigned integer.
 E.g. the C64, from memory, had an ASR (arithmetic shift right) and a SHR
(shift right), the latter treating the register as unsigned.  MVS had the
same, and I presume intel has the same (look it up).  The compiler knows
whether the value is signed or unsigned, and generates the correct
instruction. BFN.  Paul.
@EOT:

---
* Origin: X (3:711/934.9)

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.