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: Hex Kategorie: Programmierung Basic (von Achim - 3.02.2006 11:13)
 Als Antwort auf Re: Hex von Windt H.J. - 3.02.2006 0:30
Achim nutzt:  CC1-Station V1.1
> Thanks Achim, IÂ’ll be the first to admit that you are correct! ;)
> Your idea also gave me a new idea, have a look.
> It looks a lot “cleaner” this way.

> temp = (variable and 61440) shr 12 : if temp < 10 then put temp + &h30 else put temp + &h37
> temp = (variable and 3840) shr 8 : if temp < 10 then put temp + &h30 else put temp + &h37
> temp = (variable and 240) shr 4 : if temp < 10 then put temp + &h30 else put temp + &h37
> temp = (variable and 15) : if temp < 10 then put temp + &h30 else put temp + &h37

Wouldn't it be so much more "readable" if you used hex constants for the bit masks?

(variable and &HF000) shr 12
(variable and &H0F00) shr 8
(variable and &H00F0) shr 4
(variable and &H000F)

Just my 2 cents

Bye
 Achim

 Antwort schreiben

Bisherige Antworten:

Re: Hex (von Windt H.J. - 4.02.2006 18:09)