summaryrefslogtreecommitdiff
path: root/src/uint128p.c
diff options
context:
space:
mode:
authorJannis Hoffmann <jannis@fehcom.de>2024-07-09 15:50:21 +0200
committerJannis Hoffmann <jannis@fehcom.de>2024-07-09 15:50:21 +0200
commit795ffc5e62e8ba383575dbcd9943a580d4bd3358 (patch)
treec128889056202b255e2f22afeb7717894d350862 /src/uint128p.c
parent5fadc0cbb8577c61d66bd6f19ceaf0507c11e23b (diff)
formatting changes
Manual format adjustments. Comment adjustments. Remove usage of the register keyword.
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;