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

Offline c0d3r9

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 503
    • 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 3400G - MSI B450 Tomahawk - 16GB DDR4