Click here to Skip to main content
15,880,469 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Ok.. so I made a server-socket based tetris game using the winsock2 Windows Socket API. I finished the program, it works fine, and i actually have no problem in setting up the socket or the WSA. But there's something i don't understand from the winsock2 API. The function MAKEWORD(BYTE bLow,BYTE bHigh).
What does it mean? Can anyone give me a good example of what does this function mean.
I've looked up for the macro, i don't have any problem understanding it. the only problem is i don't understand the concept of MAKEWORD or what is it for.
can anyone help me?
Any help would be really appreciated.
Posted
Updated 3-Jan-13 22:39pm
v2

The documentation [^] says it all: "Creates a WORD value by concatenating the specified (byte) values".
It is just an auxiliary macro, useful if you have two bytes and need to 'glue' them in a word. A similar macro (whose usefulness is apparent) is RGB[^].
 
Share this answer
 
Comments
fjdiewornncalwe 4-Jan-13 16:43pm    
+5.
A BYTE contains 8 (usable) bits. In this context, a WORD contains 16 bits or 2 BYTEs. These can be represented as

           +--------+--------+
2 BYTEs    |bbbbbbbb|bbbbbbbb|
           +--------+--------+
1 WORD     +wwwwwwww wwwwwwww|
           +--------+--------+

You can build a WORD out of 2 BYTEs. There is an upper BYTE and lower BYTE. The macro you describe does exactly that.
 
Share this answer
 
Comments
fjdiewornncalwe 4-Jan-13 16:43pm    
+5. Well explained.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900