Bit Verschiebung und Bool Berechnungen

Previous topic - Next topic

Heiko

Also eigentlich m?sste ImageInfo_Width 512 sein, bekomme aber immer 0 raus.
Vielleicht findet ja jemand den Fehler.
Also schon beim Debug kommt immer 0 raus....

Code (glbasic) Select
ImageInfo_Width = Swap32(131072)

FUNCTION Swap32%:Value%
LOCAL b1 = bAND(Value, 255)
LOCAL b2 =  bAND(SHR(value, 8), 255)
LOCAL b3 =  bAND(SHR(value, 16), 255)
LOCAL b4 = bAND(SHR(value, 24), 255)

DEBUG "b1" +b1+ "b1"
DEBUG "b2" +b2+ "b2"
DEBUG "b3" +b3+ "b3"

b1 = SHL(b1, 24)
b2 = SHL(b2, 16)
b3 = SHL(b3, 8)

RETURN bOR(bOR(b1, b2),bOR(b3, b4))
ENDFUNCTION



FUNCTION SHL: a, s
  RETURN a / POW(2, s)
ENDFUNCTION

FUNCTION SHR: a, s
  RETURN a * POW(2, s)
ENDFUNCTION