Einzelnen Beitrag anzeigen

Benutzerbild von Amnon82
Amnon82

Registriert seit: 5. Jan 2005
186 Beiträge
 
FreePascal / Lazarus
 
#3

Re: Bit Operations (Bit in HEX)

  Alt 20. Mär 2006, 11:45
Ich habs aber in 8-bit hex number bit-mapped:

Beispiel:
Code:
92 b2 a2 b2 b2 a2 b2 b2 a2 b2 b2 a2
Ich müsste es für bit6 zum Beispiel so auslesen:

Delphi-Quellcode:
if val and $40 > 0 then
    pff := 1
else
    pff := 0;
Nun brauchs ich aber auch für bit1 zum Beispiel.

Dann müsste es nach deinem Post dann so sein:

Bit0 = $01
Bit1 = Bit0*2 > $02
Bit2 = Bit1*2 > $04
Bit3 = Bit2*2 > $10
Bit5 = Bit4*2 > $20
Bit6 = Bit5*2 > $40

$40 = 64
$20 = 32
$10 = 16
$04 = 8
$02 = 4
$01 = 2
  Mit Zitat antworten Zitat