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

/* Alterado forma de calcular número de dígitos em um número.

   No momento, um número máximo de 6 dígitos.
   Foi comentado o cálculo genérico usando log(n)
 */
parent faf33082
No related branches found
No related tags found
No related merge requests found
......@@ -28,7 +28,7 @@ double timestamp(void)
*/
string_t markerName(string_t baseName, int n)
{
string_t mark = (string_t) malloc( (strlen(baseName)+1) + ( (int) log10(n) + 1) + 1 );
string_t mark = (string_t) malloc( (strlen(baseName)+1) + numDigits(n) + 1 );
sprintf(mark, "%s_%u", baseName,n);
......
......@@ -14,6 +14,9 @@ typedef char * string_t;
#define ALIGN_32 __attribute__((aligned(32)))
#define ALIGN_16 __attribute__((aligned(16)))
// Número máximo de dígitos em um número
#define numDigits(n) 6 // ( (int) log10(n) + 1 )
// Macro para verificar de valor 'n' é potência de 2 ou não
#define isPot2(n) (n && !(n & (n - 1)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment