Page 2 of 2

Re: Hi and loword

Posted: Fri Dec 15, 2023 2:38 am
by jacdelad
Searched for this and got here. Works so far, but if you want to use a formula as input variable, it doesn't work. Simple workaround:

Code: Select all

Macro LOWORD(a):((a)&$ffff):EndMacro
Macro HIWORD(a):(((a)>>16)&$ffff):EndMacro
Macro MAKELONG(a,b):(((a)&$ffff)+(b)<<16):EndMacro

Re: Hi and loword

Posted: Fri Dec 15, 2023 2:33 pm
by HeX0R
You've copied the mistake from Rescator :mrgreen:

Re: Hi and loword

Posted: Fri Dec 15, 2023 10:09 pm
by jacdelad
Which mistake? :shock: The missing "&"? Corrected it. Thanks for pointing that out (if there's no more mistakes in it).
ANyway, I agree with everyone that these should be built-in.

Re: Hi and loword

Posted: Sun Dec 17, 2023 10:51 pm
by Quin
+1

Re: Hi and loword

Posted: Thu Feb 15, 2024 11:14 pm
by idle
This can be easily done in a structure

Code: Select all

Structure int32 
  StructureUnion
    a.a[4]
    u.u[2]
    l.l
  EndStructureUnion
EndStructure  

Global a.int32 
a\l = $aaaabbbb 

Debug Hex(a\u[0]) 
Debug Hex(a\u[1])