Skip to content

Commit 18e7c04

Browse files
committed
Add "PRIu64" into main.c
Use "PRIu64" to replace the print format of uint64_t variable.
1 parent d65cc96 commit 18e7c04

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

Diff for: expression.c

-1
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,6 @@ static uint64_t power(uint64_t a, uint64_t b)
308308
a = mult(a, base);
309309

310310
if (neg) {
311-
pr_alert("is neg: %llu", a);
312311
return divid((uint64_t) 1 << 32, a);
313312
} else
314313
return a;

Diff for: main.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ MODULE_VERSION("0.1");
2020
#define CLASS_NAME "calc"
2121
#define BUFF_SIZE 256
2222

23+
#define PRIu64 "llu"
24+
2325
static int major;
2426
static char message[BUFF_SIZE] = {0};
2527
static short size_of_message;
@@ -61,12 +63,12 @@ static ssize_t dev_read(struct file *filep,
6163

6264
memset(message, 0, sizeof(char) * BUFF_SIZE);
6365

64-
snprintf(message, 64, "%lu\n", result);
66+
snprintf(message, 64, "%" PRIu64 "\n", (unsigned long long) result);
6567
size_of_message = strlen(message);
6668

6769
error_count = copy_to_user(buffer, message, size_of_message);
6870
if (error_count == 0) {
69-
pr_info("size: %d result: %llu\n", size_of_message, result);
71+
pr_info("size: %d result: %" PRIu64 "\n", size_of_message, result);
7072
while (len && *msg_ptr) {
7173
error_count = put_user(*(msg_ptr++), buffer++);
7274
len--;
@@ -143,7 +145,7 @@ static void calc(void)
143145
}
144146

145147
result = expr_eval(e);
146-
pr_info("Result: %llu\n", result);
148+
pr_info("Result: %" PRIu64 "\n", result);
147149
expr_destroy(e, &vars);
148150
}
149151

Diff for: scripts/aspell-pws

+1
Original file line numberDiff line numberDiff line change
@@ -167,3 +167,4 @@ fixedp
167167
calc
168168
Makefile
169169
unpatch
170+
PRIu64

0 commit comments

Comments
 (0)