Das Open-Control-Projekt - Die Alternative zur C-Control-I


Das Forum zur C-Control-1
Welche C-Control-Varianten existieren?
Übersicht - Suchen - Neueste 50 Beiträge - Neuer Beitrag - Login - Registrieren
INFO - FAQ - CC2-Forum - CCPro-Forum 

 Re: Word into Bytes.. why does this not work?? Kategorie: C-Control I V1.2/2.0 (von Achim - 17.05.2008 21:23)
 Als Antwort auf Re: Word into Bytes.. why does this not work?? von Windt H.J. - 17.05.2008 19:31
Achim nutzt:  CC1-Station V1.1
> ItÂ’s a thinking error of my own.
> I read a long time ago that to break up a word into its 2 bytes you could do the following:
>
> Hibyte = word / 256
> Lobyte = word mod 256

Well, I guess your programm proved that what you read is not (always) true.

> -1 is nothing but decimal 65535

Many 4th grade pupils probably would beg to differ. ;-) Both numbers might be represented by the same bit pattern (under certain circumstances), but that bit pattern can't be interpreted as both numbers at the same time. And since an arithmetical division ought to consider the sign, it is quite important, as which number the bit pattern is interpreted. BTW: You're just lucky that the shr-Operation you used is operating on a logical bit base and not on an arithmetical one as in CC 1.1 (which would keep the high bit as it is instead of inserting 0s).

Bye
 Achim

 Antwort schreiben

Bisherige Antworten: