diff options
Diffstat (limited to 'src/cmd/netstack/util.h')
-rw-r--r-- | src/cmd/netstack/util.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/cmd/netstack/util.h b/src/cmd/netstack/util.h index c1032a2..1cd22fb 100644 --- a/src/cmd/netstack/util.h +++ b/src/cmd/netstack/util.h @@ -40,3 +40,15 @@ static inline uint32_t nget32(const void *vbuf) { | (b[2] << 8) | (b[3] << 0); } + +static inline uint64_t nget64(const void *vbuf) { + const uint8_t *b = vbuf; + return ((uint64_t)b[0] << 56) + | ((uint64_t)b[1] << 48) + | ((uint64_t)b[2] << 40) + | ((uint64_t)b[3] << 32) + | ((uint64_t)b[4] << 24) + | ((uint64_t)b[5] << 16) + | ((uint64_t)b[6] << 8) + | ((uint64_t)b[7] << 0); +} |