public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/kubaneko/heads/histogram)] fixed logarithm
@ 2023-02-23 23:20 Ondrej Kubanek
  0 siblings, 0 replies; 2+ messages in thread
From: Ondrej Kubanek @ 2023-02-23 23:20 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:66ef90415362ae47d0064a8605c987b65f4aad4a

commit 66ef90415362ae47d0064a8605c987b65f4aad4a
Author: Ondrej Kubanek <kubanek0ondrej@gmail.com>
Date:   Wed Jul 27 14:02:24 2022 +0200

    fixed logarithm

Diff:
---
 libgcc/libgcov-profiler.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libgcc/libgcov-profiler.c b/libgcc/libgcov-profiler.c
index ed5769c284a..619f1aafe8a 100644
--- a/libgcc/libgcov-profiler.c
+++ b/libgcc/libgcov-profiler.c
@@ -39,12 +39,12 @@ __gcov_histogram_profiler (gcov_type *counters, gcov_type value)
     counters[value-1]++;
   }else{
     int pow2 = 3;
-    while (1 >> pow2 <= value){
+    while (1 << pow2 <= value || 1 << pow2 > 1 << (pow2 + 1)){
       ++pow2;
     }
     // pow2 is first bigger power of 2
     // we increment closer power of 2
-    if ((1>>pow2+1>>(pow2-1))<<1<value){
+    if ((1<<pow2+1<<(pow2-1))>>1<value){
       counters[6+(pow2-3)-1]++;
     }
     else{

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [gcc(refs/users/kubaneko/heads/histogram)] fixed logarithm
@ 2023-02-16 16:26 Ondrej Kubanek
  0 siblings, 0 replies; 2+ messages in thread
From: Ondrej Kubanek @ 2023-02-16 16:26 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:f41c4e98f18d9e07b9b525f07a675190b5f0fbbc

commit f41c4e98f18d9e07b9b525f07a675190b5f0fbbc
Author: Ondrej Kubanek <kubanek0ondrej@gmail.com>
Date:   Wed Jul 27 14:02:24 2022 +0200

    fixed logarithm

Diff:
---
 libgcc/libgcov-profiler.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libgcc/libgcov-profiler.c b/libgcc/libgcov-profiler.c
index 8229e047b0e..f07f9c34021 100644
--- a/libgcc/libgcov-profiler.c
+++ b/libgcc/libgcov-profiler.c
@@ -39,12 +39,12 @@ __gcov_histogram_profiler (gcov_type *counters, gcov_type value)
     counters[value-1]++;
   }else{
     int pow2 = 3;
-    while (1 >> pow2 <= value){
+    while (1 << pow2 <= value || 1 << pow2 > 1 << (pow2 + 1)){
       ++pow2;
     }
     // pow2 is first bigger power of 2
     // we increment closer power of 2
-    if ((1>>pow2+1>>(pow2-1))<<1<value){
+    if ((1<<pow2+1<<(pow2-1))>>1<value){
       counters[6+(pow2-3)-1]++;
     }
     else{

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-23 23:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-23 23:20 [gcc(refs/users/kubaneko/heads/histogram)] fixed logarithm Ondrej Kubanek
  -- strict thread matches above, loose matches on Subject: below --
2023-02-16 16:26 Ondrej Kubanek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).