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

/* isPot2()n agora é uma macro que não usa log2(). Ver 'utils.h' */

parent e8f6ee80
No related branches found
No related tags found
No related merge requests found
...@@ -33,8 +33,10 @@ string_t markerName(string_t baseName, int n) ...@@ -33,8 +33,10 @@ string_t markerName(string_t baseName, int n)
} }
/*
int isPot2(int n) int isPot2(int n)
{ {
int k; int k;
return (k = log2(n)) == log2(n) ; return (k = log2(n)) == log2(n) ;
} }
*/
...@@ -16,7 +16,9 @@ typedef char * string_t; ...@@ -16,7 +16,9 @@ typedef char * string_t;
double timestamp(void); double timestamp(void);
string_t markerName(string_t baseName, int n); string_t markerName(string_t baseName, int n);
int isPot2 (int n); // int isPot2 (int n);
#define isPot2(n) (n && !(n & (n - 1)))
#endif // __UTILS_H__ #endif // __UTILS_H__
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