Skip to content

Commit

Permalink
Merge pull request #252 from blanktonio/progress_pow
Browse files Browse the repository at this point in the history
Prevent use of run-time floating point math functions for compile-time integer constants
  • Loading branch information
Thomas-Tsai authored Oct 7, 2024
2 parents 9cbf2be + f7ea3db commit 7f00675
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/progress.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#include <time.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>
#include <math.h>
#include <float.h>
#include "config.h"
#include "progress.h"
#include "gettext.h"
Expand Down Expand Up @@ -119,12 +119,12 @@ static void calculate_speed(struct progress_bar *prog, unsigned long long copied
char Rformated[12], Eformated[12];
char speed_unit[] = " ";
struct tm *Rtm, *Etm;
uint64_t gibyte = pow(2,30);
uint64_t mibyte = pow(2,20);
uint64_t kibyte = pow(2,10);
uint64_t gbyte = 1000000000.0;
uint64_t mbyte = 1000000;
uint64_t kbyte = 1000;
uint64_t gibyte = UINT64_C(1) << 30;
uint64_t mibyte = UINT64_C(1) << 20;
uint64_t kibyte = UINT64_C(1) << 10;
uint64_t gbyte = UINT64_C(1000000000);
uint64_t mbyte = UINT64_C(1000000);
uint64_t kbyte = UINT64_C(1000);
int spflen = 0;
int prefered_bits_size = prog->binary_prefix;

Expand Down

0 comments on commit 7f00675

Please sign in to comment.