Skip to contentSkip to conversation

softfloat: Fix shift128Right for shift counts 64..127

PATCH Applied Peter Maydell 3 participants 3 messages Jun 2, 2013 – Jun 10, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 softfloat: Fix shift128Right for shift counts 64..127

shift128Right would give the wrong result for a shift count between 64 and 127. This was never noticed because all of our uses of this function are guaranteed not to use shift counts in this range.

---
Found by code inspection. This contribution can be licensed under either the softfloat-2a or -2b license.

 fpu/softfloat-macros.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fpu/softfloat-macros.h +1 -1
index b5164af..9b09545 100644
@@ -168,7 +168,7 @@ INLINE void
         z0 = a0>>count;
     }
     else {
-        z1 = ( count < 64 ) ? ( a0>>( count & 63 ) ) : 0;
+        z1 = (count < 128) ? (a0 >> (count & 63)) : 0;
         z0 = 0;
     }
     *z1Ptr = z1;
Signature · 1 line
1.7.11.4
Reviewed-by on v1 1/1
#1 lore raw

Il 02/06/2013 17:17, Peter Maydell ha scritto:

Quoted 19 lines

shift128Right would give the wrong result for a shift count between 64 and 127. This was never noticed because all of our uses of this function are guaranteed not to use shift counts in this range.

---
Found by code inspection. This contribution can be licensed under either the softfloat-2a or -2b license.

 fpu/softfloat-macros.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fpu/softfloat-macros.h +0 -0
index b5164af..9b09545 100644

fpu/softfloat-macros.h INLINE void · line 174

Quoted 8 lines
fpu/softfloat-macros.h +1 -1
@@ -168,7 +168,7 @@ INLINE void
         z0 = a0>>count;
     }
     else {
-        z1 = ( count < 64 ) ? ( a0>>( count & 63 ) ) : 0;
+        z1 = (count < 128) ? (a0 >> (count & 63)) : 0;
         z0 = 0;
     }
     *z1Ptr = z1;