summaryrefslogtreecommitdiff
path: root/src/pack.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pack.c')
-rw-r--r--src/pack.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/pack.c b/src/pack.c
index 0fa3274..b9a23be 100644
--- a/src/pack.c
+++ b/src/pack.c
@@ -1,10 +1,18 @@
#include <stdio.h>
-int reverseint(const unsigned char in[4])
+int frombigendian(const unsigned char in[4])
{
return (in[0] << 24) | (in[1] << 16) | (in[2] << 8) | in[3];
}
+void tobigendian(const int in, unsigned char out[4])
+{
+ out[0] = (in >> 24) & 0xff;
+ out[1] = (in >> 16) & 0xff;
+ out[2] = (in >> 8) & 0xff;
+ out[3] = in & 0xff;
+}
+
int readint(unsigned char **cp)
{
int result = 0;