Author Topic: Bit Verschiebung und Bool Berechnungen  (Read 904 times)

Offline Heiko

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 500
    • View Profile
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
Ryzen 5 2400G - MSI B450 Tomahawk