From faf33082c31b59c9c1f6d68e05bd8941d7527e16 Mon Sep 17 00:00:00 2001
From: Armando Luiz Nicolini Delgado <nicolui@inf.ufpr.br>
Date: Sun, 24 Apr 2022 18:10:46 -0300
Subject: [PATCH] =?UTF-8?q?/*=20Corre=C3=A7=C3=A3o=20em=20'markerName()'.?=
 =?UTF-8?q?=20=20=20=20Acr=C3=A9scimo=20de=20coment=C3=A1rios=20em=20'util?=
 =?UTF-8?q?s.c'=20*/?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 utils/utils.c | 11 ++++++++++-
 utils/utils.h |  6 +++---
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/utils/utils.c b/utils/utils.c
index fe9bd3c..9bab73c 100644
--- a/utils/utils.c
+++ b/utils/utils.c
@@ -21,9 +21,14 @@ double timestamp(void)
   return((double)(tp.tv_sec*1.0e3 + tp.tv_nsec*1.0e-6));
 }
 
+/* Gera string '<baseName>_n'
+ * Por exemplo, se baseName = "ABC" e n = 10,
+ *  Função retorna a string "ABC_10"
+ * Útil para gerar marcadores para LIKWID
+ */
 string_t markerName(string_t baseName, int n)
 {
-  string_t mark = (string_t) malloc( (strlen(baseName)+1) + (log10(n)+1) + 1 );
+  string_t mark = (string_t) malloc( (strlen(baseName)+1) + ( (int) log10(n) + 1) + 1 );
 
   sprintf(mark, "%s_%u", baseName,n);
 
@@ -34,6 +39,10 @@ string_t markerName(string_t baseName, int n)
 }
 
 /*
+// Retorna TRUE se 'n' é uma potência de 2
+// [OBSOLETO] 
+// Definida macro em 'utils.h' para substituir esta função
+//
 int isPot2(int n)
 {
   int k;
diff --git a/utils/utils.h b/utils/utils.h
index b48f3c2..6e4dde8 100644
--- a/utils/utils.h
+++ b/utils/utils.h
@@ -14,11 +14,11 @@ typedef char * string_t;
 #define ALIGN_32 __attribute__((aligned(32)))
 #define ALIGN_16 __attribute__((aligned(16)))
 
+// Macro para verificar de valor 'n' é potência de 2 ou não
+#define isPot2(n) (n && !(n & (n - 1)))
+
 double timestamp(void);
 string_t markerName(string_t baseName, int n);
-// int isPot2 (int n);
-
-#define isPot2(n) (n && !(n & (n - 1)))
 
 #endif // __UTILS_H__
 
-- 
GitLab