The compiler might do both loads from the same address and then
increment twice, or load the second nibble before the first one.

Signed-off-by: Stefan Brüns <stefan.bru...@rwth-aachen.de>
---
 src/cmd/gdbserver.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/cmd/gdbserver.cpp b/src/cmd/gdbserver.cpp
index 28b1ea7..7273460 100644
--- a/src/cmd/gdbserver.cpp
+++ b/src/cmd/gdbserver.cpp
@@ -949,9 +949,9 @@ void GdbServer::gdb_write_memory(const char *pkt) {
     }
     else if ( (addr & MEM_SPACE_MASK) == SIGNATURE_OFFSET && len >= 3)
     {
-        int sig3 = (hex2nib(*pkt++) << 4) + hex2nib(*pkt++);
-        int sig2 = (hex2nib(*pkt++) << 4) + hex2nib(*pkt++);
-        int sig1 = (hex2nib(*pkt++) << 4) + hex2nib(*pkt++);
+        int sig3 = (hex2nib(*pkt++) << 4); sig3 += hex2nib(*pkt++);
+        int sig2 = (hex2nib(*pkt++) << 4); sig2 += hex2nib(*pkt++);
+        int sig1 = (hex2nib(*pkt++) << 4); sig1 += hex2nib(*pkt++);
         if (global_debug_on)
             fprintf(stderr, "Device signature %02x %02x %02x\n", sig1, sig2, 
sig3);
     }
-- 
1.8.4


_______________________________________________
Simulavr-devel mailing list
Simulavr-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/simulavr-devel

Reply via email to