diff options
author | Mike Frysinger <vapier@gentoo.org> | 2022-10-26 22:42:10 +0545 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2022-10-31 21:24:39 +0545 |
commit | ed60d3edd51f6c33fb0f3f09400094a1b1c2ceb2 (patch) | |
tree | 9fec7827dac0d17642f854d02c497a3b45692dfb /sim/d10v | |
parent | ead2618501e8ba696bf29de635a9a5f6a1ba1b0e (diff) | |
download | gdb-ed60d3edd51f6c33fb0f3f09400094a1b1c2ceb2.zip gdb-ed60d3edd51f6c33fb0f3f09400094a1b1c2ceb2.tar.gz gdb-ed60d3edd51f6c33fb0f3f09400094a1b1c2ceb2.tar.bz2 |
sim: constify various integer readers
These functions only read from memory, so mark the pointer as const.
Diffstat (limited to 'sim/d10v')
-rw-r--r-- | sim/d10v/d10v_sim.h | 6 | ||||
-rw-r--r-- | sim/d10v/endian.c | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/sim/d10v/d10v_sim.h b/sim/d10v/d10v_sim.h index 7b354fd..e78ea2f 100644 --- a/sim/d10v/d10v_sim.h +++ b/sim/d10v/d10v_sim.h @@ -445,9 +445,9 @@ extern uint8_t *imem_addr (SIM_DESC, SIM_CPU *, uint32_t); #undef ENDIAN_INLINE #else -extern uint32_t get_longword (uint8_t *); -extern uint16_t get_word (uint8_t *); -extern int64_t get_longlong (uint8_t *); +extern uint32_t get_longword (const uint8_t *); +extern uint16_t get_word (const uint8_t *); +extern int64_t get_longlong (const uint8_t *); extern void write_word (uint8_t *addr, uint16_t data); extern void write_longword (uint8_t *addr, uint32_t data); extern void write_longlong (uint8_t *addr, int64_t data); diff --git a/sim/d10v/endian.c b/sim/d10v/endian.c index f3e1e46..44e80e6 100644 --- a/sim/d10v/endian.c +++ b/sim/d10v/endian.c @@ -11,19 +11,19 @@ #endif ENDIAN_INLINE uint16_t -get_word (uint8_t *x) +get_word (const uint8_t *x) { return ((uint16_t)x[0]<<8) + x[1]; } ENDIAN_INLINE uint32_t -get_longword (uint8_t *x) +get_longword (const uint8_t *x) { return ((uint32_t)x[0]<<24) + ((uint32_t)x[1]<<16) + ((uint32_t)x[2]<<8) + ((uint32_t)x[3]); } ENDIAN_INLINE int64_t -get_longlong (uint8_t *x) +get_longlong (const uint8_t *x) { uint32_t top = get_longword (x); uint32_t bottom = get_longword (x+4); |