diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2010-07-09 12:32:17 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2010-07-09 12:32:17 +0200 |
commit | 6c027b4de25a529908be895e7ff19236f4002a57 (patch) | |
tree | f70d3a400bbb9ba8a83e9d4ffcaa4b6e367fc8bb /uint16_unpack.c | |
download | crypto-6c027b4de25a529908be895e7ff19236f4002a57.zip crypto-6c027b4de25a529908be895e7ff19236f4002a57.tar.gz |
initial commit, resurrect one of my realy old projects
Diffstat (limited to 'uint16_unpack.c')
-rw-r--r-- | uint16_unpack.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/uint16_unpack.c b/uint16_unpack.c new file mode 100644 index 0000000..3821853 --- /dev/null +++ b/uint16_unpack.c @@ -0,0 +1,21 @@ +#include "uint16.h" + +__inline void u16_unpack(const char s[2],u16 *u) +{ + u16 result; + + result = (unsigned char) s[1]; result <<= 8; + result += (unsigned char) s[0]; + + *u = result; +} + +__inline void u16_unpack_big(const char s[2],u16 *u) +{ + u16 result; + + result = (unsigned char) s[0]; result <<= 8; + result += (unsigned char) s[1]; + + *u = result; +} |