summaryrefslogtreecommitdiff
path: root/src/uint128p.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/uint128p.c')
-rw-r--r--src/uint128p.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/uint128p.c b/src/uint128p.c
index a06da72..e92b5a7 100644
--- a/src/uint128p.c
+++ b/src/uint128p.c
@@ -1,10 +1,10 @@
#include "uint_t.h"
/**
- @file uint128p.c
- @author feh, jannis
- @source djbdns6
- @brief packing/unpacking 128 bit integer to/from char string
+ @file uint128p.c
+ @author feh, jannis
+ @source djbdns6
+ @brief packing/unpacking 128 bit integer to/from char string
*/
void uint128_pack(char s[16], uint128 u)
@@ -29,6 +29,7 @@ void uint128_pack(char s[16], uint128 u)
s[15] = u.hi & 255;
// clang-format on
}
+
void uint128_pack_big(char s[16], uint128 u)
{
// clang-format off
@@ -67,7 +68,7 @@ void uint128_unpack(char s[16], uint128 *u)
result.hi += (unsigned char) s[9]; result.hi <<= 8;
result.hi += (unsigned char) s[8]; //correct
- result.lo += (unsigned char) s[7]; result.lo <<= 8;
+ result.lo += (unsigned char) s[7]; result.lo <<= 8;
result.lo += (unsigned char) s[6]; result.lo <<= 8;
result.lo += (unsigned char) s[5]; result.lo <<= 8;
result.lo += (unsigned char) s[4]; result.lo <<= 8;
@@ -93,7 +94,7 @@ void uint128_unpack_big(char s[16], uint128 *u)
result.hi += (unsigned char) s[5]; result.hi <<= 8;
result.hi += (unsigned char) s[6]; result.hi <<= 8;
result.hi += (unsigned char) s[7];
-
+
result.lo += (unsigned char) s[8]; result.lo <<= 8;
result.lo += (unsigned char) s[9]; result.lo <<= 8;
result.lo += (unsigned char) s[10]; result.lo <<= 8;