diff options
| author | johannes <johannes.herman@gmail.com> | 2024-02-06 19:56:18 +0100 |
|---|---|---|
| committer | johannes <johannes.herman@gmail.com> | 2024-02-06 19:56:18 +0100 |
| commit | edff23604a6ae5b46980f7b2f9e9f4f36155189a (patch) | |
| tree | 6b811e7538f5cacb0f63c2bf0a3783e8356b0597 /src/pack.c | |
| parent | ec6a5c1ff3bb7731e17b798f9bbfdb0aedf94baa (diff) | |
added write demo functions
Diffstat (limited to 'src/pack.c')
| -rw-r--r-- | src/pack.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -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; |
