diff --git a/src/serialize.h b/src/serialize.h index 817591b989f93..69aaeb4c39787 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -67,54 +67,54 @@ extern "C" { #define LAST_TAG 57 #define write_uint8(s, n) ios_putc((n), (s)) -#define read_uint8(s) ((uint8_t)ios_getc(s)) -#define write_int8(s, n) write_uint8(s, n) -#define read_int8(s) read_uint8(s) +#define read_uint8(s) ((uint8_t)ios_getc((s))) +#define write_int8(s, n) write_uint8((s), (n)) +#define read_int8(s) read_uint8((s)) /* read and write in host byte order */ -static void write_int32(ios_t *s, int32_t i) JL_NOTSAFEPOINT +static inline void write_int32(ios_t *s, int32_t i) JL_NOTSAFEPOINT { ios_write(s, (char*)&i, 4); } -static int32_t read_int32(ios_t *s) JL_NOTSAFEPOINT +static inline int32_t read_int32(ios_t *s) JL_NOTSAFEPOINT { int32_t x = 0; ios_read(s, (char*)&x, 4); return x; } -static uint64_t read_uint64(ios_t *s) JL_NOTSAFEPOINT +static inline uint64_t read_uint64(ios_t *s) JL_NOTSAFEPOINT { uint64_t x = 0; ios_read(s, (char*)&x, 8); return x; } -static void write_int64(ios_t *s, int64_t i) JL_NOTSAFEPOINT +static inline void write_int64(ios_t *s, int64_t i) JL_NOTSAFEPOINT { ios_write(s, (char*)&i, 8); } -static void write_uint16(ios_t *s, uint16_t i) JL_NOTSAFEPOINT +static inline void write_uint16(ios_t *s, uint16_t i) JL_NOTSAFEPOINT { ios_write(s, (char*)&i, 2); } -static uint16_t read_uint16(ios_t *s) JL_NOTSAFEPOINT +static inline uint16_t read_uint16(ios_t *s) JL_NOTSAFEPOINT { int16_t x = 0; ios_read(s, (char*)&x, 2); return x; } -static void write_uint32(ios_t *s, uint32_t i) JL_NOTSAFEPOINT +static inline void write_uint32(ios_t *s, uint32_t i) JL_NOTSAFEPOINT { ios_write(s, (char*)&i, 4); } -static uint32_t read_uint32(ios_t *s) JL_NOTSAFEPOINT +static inline uint32_t read_uint32(ios_t *s) JL_NOTSAFEPOINT { uint32_t x = 0; ios_read(s, (char*)&x, 4); diff --git a/src/staticdata.c b/src/staticdata.c index 4eeef024139c5..e8ce9601527ad 100644 --- a/src/staticdata.c +++ b/src/staticdata.c @@ -64,6 +64,7 @@ done by `get_item_for_reloc`. #include "julia_internal.h" #include "builtin_proto.h" #include "processor.h" +#include "serialize.h" #ifndef _OS_WINDOWS_ #include <dlfcn.h> @@ -364,25 +365,6 @@ typedef enum { // if a larger size is required, will need to add support for writing larger relocations in many cases below #define RELOC_TAG_OFFSET 29 - -/* read and write in host byte order */ - -#define write_uint8(s, n) ios_putc((n), (s)) -#define read_uint8(s) ((uint8_t)ios_getc((s))) - -static void write_uint32(ios_t *s, uint32_t i) JL_NOTSAFEPOINT -{ - ios_write(s, (char*)&i, 4); -} - -static uint32_t read_uint32(ios_t *s) JL_NOTSAFEPOINT -{ - uint32_t x = 0; - ios_read(s, (char*)&x, 4); - return x; -} - - // --- Static Compile --- static void *jl_sysimg_handle = NULL;