From a52a39179a47ee125e88ae0938f06d08cf5723ce Mon Sep 17 00:00:00 2001 From: grischka Date: Sun, 20 Nov 2016 14:52:56 +0100 Subject: tccelf: introduce add32/64le() --- tcc.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tcc.h') diff --git a/tcc.h b/tcc.h index ed134d7..180838d 100644 --- a/tcc.h +++ b/tcc.h @@ -1423,12 +1423,18 @@ static inline uint32_t read32le(unsigned char *p) { static inline void write32le(unsigned char *p, uint32_t x) { write16le(p, x), write16le(p + 2, x >> 16); } +static inline void add32le(unsigned char *p, int32_t x) { + write32le(p, read32le(p) + x); +} static inline uint64_t read64le(unsigned char *p) { return read32le(p) | (uint64_t)read32le(p + 4) << 32; } static inline void write64le(unsigned char *p, uint64_t x) { write32le(p, x), write32le(p + 4, x >> 32); } +static inline void add64le(unsigned char *p, int64_t x) { + write64le(p, read64le(p) + x); +} /* ------------ i386-gen.c ------------ */ #if defined TCC_TARGET_I386 || defined TCC_TARGET_X86_64 -- cgit v1.3.1