From 1b48aac5a56a3ccb39f2ff66d4cde4244da2caa6 Mon Sep 17 00:00:00 2001 From: "7u83@mail.ru" <7u83@mail.ru@noemail.net> Date: Fri, 4 Mar 2016 19:23:14 +0000 Subject: [PATCH] Some functions added. FossilOrigin-Name: 4cd783cf7ac0d52e21307283408879cf88c2d8a2b01ab618a0e60526f48b64c7 --- src/cw/lw.h | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/cw/lw.h diff --git a/src/cw/lw.h b/src/cw/lw.h new file mode 100644 index 00000000..1f7f1164 --- /dev/null +++ b/src/cw/lw.h @@ -0,0 +1,43 @@ +#ifndef __LW_H +#define __LW_H + +/** + * @defgroup LW LWAPP Functions + * @{ + */ + + +#define lw_put_byte(dst,b) \ + (*(dst)=b,1) + +#define lw_put_word(dst,w)\ + (*((uint16_t*)(dst)) = htons(w),2) + +#define lw_put_dword(dst,dw)\ + (*((uint32_t*)(dst)) = htonl(dw),4) + +#define lw_set_byte(dst,b) \ + (*(dst)=b); + +#define lw_set_word(dst,b) \ + (*((uint16_t*)(dst)) = htons(w)) + +#define lw_set_dword(dst,dw)\ + (*((uint32_t*)(dst)) = htonl(dw)) + + +#define lw_get_byte(src)\ + (*(uint8_t*)(src)) + +#define lw_get_word(src) \ + (ntohs( *((uint16_t*)(src)))) + +#define lw_get_dword(src) \ + (ntohl( *((uint32_t*)(src)))) + +/** + * @} + */ + +#endif +