src/fat_adv.c: move up2power() from src/common.c

This commit is contained in:
Christophe Grenier 2023-08-25 11:39:22 +02:00
parent cd8d1a00d3
commit a8b22a5eed
3 changed files with 23 additions and 24 deletions

View file

@ -188,25 +188,6 @@ struct tm *localtime_r(const time_t *timep, struct tm *result)
}
#endif
/*@
@ decreases number;
@ assigns \nothing;
@*/
static unsigned int up2power_aux(const unsigned int number)
{
if(number==0)
return 0;
else
return(1+up2power_aux(number/2));
}
unsigned int up2power(const unsigned int number)
{
if(number==0)
return 1;
return (1<<up2power_aux(number-1));
}
void set_part_name(partition_t *partition, const char *src, const unsigned int max_size)
{
unsigned int i;

View file

@ -525,11 +525,6 @@ struct my_data_struct
@*/
void *MALLOC(size_t size);
/*@
@ assigns \nothing;
@*/
unsigned int up2power(const unsigned int number);
/*@
@ requires \valid(partition);
@ requires valid_partition(partition);

View file

@ -1260,6 +1260,29 @@ static void create_fat_boot_sector(disk_t *disk_car, partition_t *partition, con
free(newboot);
}
/*@
@ decreases number;
@ assigns \nothing;
@*/
static unsigned int up2power_aux(const unsigned int number)
{
if(number==0)
return 0;
else
return(1+up2power_aux(number/2));
}
/*@
@ assigns \nothing;
@*/
static unsigned int up2power(const unsigned int number)
{
if(number==0)
return 1;
return (1<<up2power_aux(number-1));
}
static int calcul_sectors_per_cluster(const upart_type_t upart_type, const unsigned long int data_size, const unsigned int fat_length, const unsigned int sector_size)
{
/* log_info("calcul_sectors_per_cluster data_size=%lu, fat_length=%u, sector_size=%u\n",data_size,fat_length,sector_size); */