Skip to contentSkip to conversation

Fix __clzsi2 logic

PATCH Superseded Tuan Phan 2 participants 7 messages Sep 30, 2022 – Oct 10, 2022

lore
Share & tools
lore

Tuan Phan

author
#0 lore raw

PATCH 1/1 Fix __clzsi2 logic

Fix the incorrect return value of __clzsi2 function.

Fixes e795b90 ("RISC-V: Add libgcc helpers for clz")
---
 grub-core/kern/compiler-rt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/kern/compiler-rt.c +1 -1
index 2057c2e0c..55ae9f97e 100644
@@ -431,7 +431,7 @@ __clzsi2 (grub_uint32_t val)
 
   for (; j; j >>= 1)
     {
-      if ((temp = val) >> j)
+      if ((temp = (val >> j)))
         {
           if (j == 1)
             {
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Tuan Phan

Fix the incorrect return value of __clzsi2 function.

Fixes e795b90 ("RISC-V: Add libgcc helpers for clz")
Quoted 9 lines
---
 grub-core/kern/compiler-rt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/kern/compiler-rt.c +0 -0
index 2057c2e0c..55ae9f97e 100644

grub-core/kern/compiler-rt.c __clzsi2 (grub_uint32_t val) · line 434

Quoted 5 lines
grub-core/kern/compiler-rt.c +1 -1
@@ -431,7 +431,7 @@ __clzsi2 (grub_uint32_t val)
 
   for (; j; j >>= 1)
     {
-      if ((temp = val) >> j)
+      if ((temp = (val >> j)))

... I will drop redundant brackets from here to be in line with things in the libgcc...

Daniel

author
#2 lore raw
Quoted 26 lines · Daniel Kiper
Quoted 4 lines · Tuan Phan

Fix the incorrect return value of __clzsi2 function.

Fixes e795b90 ("RISC-V: Add libgcc helpers for clz")
Quoted 9 lines
---
 grub-core/kern/compiler-rt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/kern/compiler-rt.c +0 -0
index 2057c2e0c..55ae9f97e 100644

grub-core/kern/compiler-rt.c __clzsi2 (grub_uint32_t val) · line 434

Quoted 5 lines
grub-core/kern/compiler-rt.c +1 -1
@@ -431,7 +431,7 @@ __clzsi2 (grub_uint32_t val)
 
   for (; j; j >>= 1)
     {
-      if ((temp = val) >> j)
+      if ((temp = (val >> j)))

... I will drop redundant brackets from here to be in line with things in the libgcc...

Quoted 2 lines

Daniel

Thanks for the review, I will drop the redundant brackets.

author
#3 lore raw

PATCH v2 1/1 Fix __clzsi2 logic

In reply to Daniel Kiper

Fix the incorrect return value of __clzsi2 function.

Fixes e795b90 ("RISC-V: Add libgcc helpers for clz")

---
V2: Drop redundant brackets

---
 grub-core/kern/compiler-rt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/kern/compiler-rt.c +1 -1
index 2057c2e0c..738bb8420 100644
@@ -431,7 +431,7 @@ __clzsi2 (grub_uint32_t val)
 
   for (; j; j >>= 1)
     {
-      if ((temp = val) >> j)
+      if (temp = (val >> j))
         {
           if (j == 1)
             {
Signature · 1 line
2.25.1
author
#4 lore raw
Quoted 26 lines · Tuan Phan

Fix the incorrect return value of __clzsi2 function.

Fixes e795b90 ("RISC-V: Add libgcc helpers for clz")

---
V2: Drop redundant brackets

---
 grub-core/kern/compiler-rt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/kern/compiler-rt.c +1 -2
index 2057c2e0c..738bb8420 100644
@@ -431,7 +431,7 @@ __clzsi2 (grub_uint32_t val)
 
   for (; j; j >>= 1)
     {
-      if ((temp = val) >> j)
+      if (temp = (val >> j))
         {
           if (j == 1)
             {
--
Quoted 3 lines

2.25.1

Hi Daniel,
Any chances that this patch will be merged soon?

Thanks,

#5 lore raw
Quoted 30 lines · Tuan Phan

On Mon, Oct 3, 2022 at 11:30 AM Tuan Phan <[email protected]> wrote:

     Fix the incorrect return value of __clzsi2 function.

     Fixes: e795b90 ("RISC-V: Add libgcc helpers for clz")
     Signed-off-by: Tuan Phan <[email protected]>
     Reviewed-by: Daniel Kiper <[email protected]>
     ---
     V2: Drop redundant brackets
     Signed-off-by: Tuan Phan <[email protected]>
     ---
      grub-core/kern/compiler-rt.c | 2 +-
      1 file changed, 1 insertion(+), 1 deletion(-)

     diff --git a/grub-core/kern/compiler-rt.c b/grub-core/kern/compiler-
     rt.c
     index 2057c2e0c..738bb8420 100644
     --- a/grub-core/kern/compiler-rt.c
     +++ b/grub-core/kern/compiler-rt.c
     @@ -431,7 +431,7 @@ __clzsi2 (grub_uint32_t val)

        for (; j; j >>= 1)
          {
     -      if ((temp = val) >> j)
     +      if (temp = (val >> j))
              {
                if (j == 1)
                  {
     --
     2.25.1
Quoted 2 lines

Hi Daniel,
Any chances that this patch will be merged soon?

It has been merged together with other patches last week.

Daniel

author
#6 lore raw
Quoted 32 lines · Daniel Kiper
Quoted 1 line · Tuan Phan

On Mon, Oct 3, 2022 at 11:30 AM Tuan Phan <[email protected]>

Quoted 29 lines · wrote:
     Fix the incorrect return value of __clzsi2 function.

     Fixes: e795b90 ("RISC-V: Add libgcc helpers for clz")
     Signed-off-by: Tuan Phan <[email protected]>
     Reviewed-by: Daniel Kiper <[email protected]>
     ---
     V2: Drop redundant brackets
     Signed-off-by: Tuan Phan <[email protected]>
     ---
      grub-core/kern/compiler-rt.c | 2 +-
      1 file changed, 1 insertion(+), 1 deletion(-)

     diff --git a/grub-core/kern/compiler-rt.c b/grub-core/kern/compiler-
     rt.c
     index 2057c2e0c..738bb8420 100644
     --- a/grub-core/kern/compiler-rt.c
     +++ b/grub-core/kern/compiler-rt.c
     @@ -431,7 +431,7 @@ __clzsi2 (grub_uint32_t val)

        for (; j; j >>= 1)
          {
     -      if ((temp = val) >> j)
     +      if (temp = (val >> j))
              {
                if (j == 1)
                  {
     --
     2.25.1
Quoted 7 lines
Quoted 2 lines

Hi Daniel,
Any chances that this patch will be merged soon?

It has been merged together with other patches last week.

Daniel

Awesome, thanks!