OSDN Git Service

Use DIV_ROUND_UP macro.
authorrelan <relan@users.noreply.github.com>
Sat, 6 Aug 2016 12:24:59 +0000 (15:24 +0300)
committerrelan <relan@users.noreply.github.com>
Sat, 6 Aug 2016 12:30:17 +0000 (15:30 +0300)
fsck/main.c
libexfat/cluster.c

index a72d74c..cda1965 100644 (file)
@@ -33,7 +33,7 @@ uint64_t files_count, directories_count;
 static int nodeck(struct exfat* ef, struct exfat_node* node)
 {
        const cluster_t cluster_size = CLUSTER_SIZE(*ef->sb);
-       cluster_t clusters = (node->size + cluster_size - 1) / cluster_size;
+       cluster_t clusters = DIV_ROUND_UP(node->size, cluster_size);
        cluster_t c = node->start_cluster;
        int rc = 0;
 
index 13bc6ce..34f027c 100644 (file)
@@ -67,7 +67,7 @@ static cluster_t s2c(const struct exfat* ef, off_t sector)
 static uint32_t bytes2clusters(const struct exfat* ef, uint64_t bytes)
 {
        uint64_t cluster_size = CLUSTER_SIZE(*ef->sb);
-       return (bytes + cluster_size - 1) / cluster_size;
+       return DIV_ROUND_UP(bytes, cluster_size);
 }
 
 cluster_t exfat_next_cluster(const struct exfat* ef,