Added some comments.

FossilOrigin-Name: ffd50b6238d95c7185487a76839f506750bfb8107dfdd40e0004bab4c74756c7
This commit is contained in:
7u83@mail.ru 2016-03-11 18:46:49 +00:00
parent 5fc5523ccc
commit 4a529fec12
1 changed files with 23 additions and 2 deletions

View File

@ -44,9 +44,15 @@
#define lw_put_dword(dst,dw)\
(*((uint32_t*)(dst)) = htonl(dw),4)
/**
* Same as #lw_set_byte, but w/o return value
*/
#define lw_set_byte(dst,b) \
(*(dst)=b);
/**
* Same as #lw_set_word, but no return value
*/
#define lw_set_word(dst,b) \
(*((uint16_t*)(dst)) = htons(w))
@ -57,19 +63,34 @@
#define lw_set_dword(dst,dw)\
(*((uint32_t*)(dst)) = htonl(dw))
/**
* Read a byte from input buffer
* @param src Pointer to input buffer
* @return the byte red
*/
#define lw_get_byte(src)\
(*(uint8_t*)(src))
/**
* Read a word from input buffer and convert it from
* network format to local format.
* @param src Pointer to input buffer
* @return word
*/
#define lw_get_word(src) \
(ntohs( *((uint16_t*)(src))))
/**
* Read a dword from input buffer and convert it from
* network format to local
* @param src Pointer to input bufffer
* @return the dword red
*/
#define lw_get_dword(src) \
(ntohl( *((uint32_t*)(src))))
/* the following functions are defined as static inline and not as
macro to avoid any side effects */