Skip to content
Snippets Groups Projects
Commit ca72d61e authored by Armando Luiz Nicolini Delgado's avatar Armando Luiz Nicolini Delgado :nerd:
Browse files

/* Alteração na definição de macro 'isPot2' */

parent b726a6c9
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include <time.h> #include <time.h>
#include <sys/time.h> #include <sys/time.h>
// Valor absoluto de um número. Alternativa ao uso da função 'fabs()' // Valor absoluto de um número real. Alternativa ao uso da função 'fabs()'
#define ABS(num) ((num) < 0.0 ? -(num) : (num)) #define ABS(num) ((num) < 0.0 ? -(num) : (num))
// real_t: tipo usado para representar valores em ponto flutuante // real_t: tipo usado para representar valores em ponto flutuante
...@@ -23,11 +23,12 @@ typedef double rtime_t; ...@@ -23,11 +23,12 @@ typedef double rtime_t;
#define ALIGN_16 __attribute__((aligned(16))) #define ALIGN_16 __attribute__((aligned(16)))
#define ALIGN_8 __attribute__((aligned(8))) #define ALIGN_8 __attribute__((aligned(8)))
// Número máximo de dígitos em um número // Número máximo de dígitos em um número inteiro
#define numDigits(n) 6 // ( (int) log10(n) + 1 ) #define numDigits(n) 6 // ( n ? (int) log10(ABS(n)) + 1 : 1 )
// Macro para verificar de valor 'n' é potência de 2 ou não // Macro para verificar de valor 'n' é potência de 2 ou não.
#define isPot2(n) (n && !(n & (n - 1))) // 'n' DEVE ser positivo e não-nulo
#define isPot2(n) (!(n & (n - 1))) // #define isPot2(n) (n && !(n & (n - 1)))
// Funções // Funções
rtime_t timestamp(void); rtime_t timestamp(void);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment