Hi and loword
-
- Addict
- Posts: 1073
- Joined: Fri Apr 25, 2003 11:13 pm
- Location: Netherlands
- Contact:
Hi and loword
I don't understand why a simple hi and loword aren't available at this time?
Afaik i made this request years ago..?
This is simpliest new feature one can bring to the compiler..
(I am aware of the workarounds)
Afaik i made this request years ago..?
This is simpliest new feature one can bring to the compiler..
(I am aware of the workarounds)
-
- Addict
- Posts: 1073
- Joined: Fri Apr 25, 2003 11:13 pm
- Location: Netherlands
- Contact:
You understand that the result might be the same but it isn't the same..
I mean i now have use pointer to variable + 2 bytes for lo or hi word.
I mean i now have use pointer to variable + 2 bytes for lo or hi word.
Last edited by Edwin Knoppert on Sat May 19, 2007 5:16 pm, edited 1 time in total.
-
- Addict
- Posts: 1073
- Joined: Fri Apr 25, 2003 11:13 pm
- Location: Netherlands
- Contact:
-
- Addict
- Posts: 1073
- Joined: Fri Apr 25, 2003 11:13 pm
- Location: Netherlands
- Contact:
Code: Select all
Macro LOWORD(Value)
Value & $FFFF
EndMacro
Macro HIWORD(Value)
(Value >> 16) & $FFFF
EndMacro

-
- Addict
- Posts: 1073
- Joined: Fri Apr 25, 2003 11:13 pm
- Location: Netherlands
- Contact:
HiWord, LoWord and some other a implemented as macro in the win API, see the windows-headers, why not use Macros in PB
Native support for this only in languages, that doesn't support macro's

Native support for this only in languages, that doesn't support macro's
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

-
- Addict
- Posts: 1073
- Joined: Fri Apr 25, 2003 11:13 pm
- Location: Netherlands
- Contact:
-
- Enthusiast
- Posts: 480
- Joined: Thu Jul 27, 2006 4:06 am
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
These are from my BASS.pbi (for the BASS audio library)
It's needed for example for getting the version of the libary (it's returned as a long but the long is actually two words)
Yeah I know, a pointer to a structure is much better solution than LOWRD and HIWORD etc. but...
I do seem to run into these from time to time. (WinAPI and various C/C++ libs)