summaryrefslogtreecommitdiff
path: root/thread_pthread_mn.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-10-29 21:27:49 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2023-10-29 21:27:49 +0900
commitfbd55120f3c58dc7d16b3870a8f36f07277bb338 (patch)
treeb4f1bfad610409aea72f1feddd7111ae5322bbd2 /thread_pthread_mn.c
parent7f2809b0a9db2a8a4a04aeaf91db191dee383574 (diff)
Cast up before multiplication
Diffstat (limited to 'thread_pthread_mn.c')
-rw-r--r--thread_pthread_mn.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/thread_pthread_mn.c b/thread_pthread_mn.c
index 8dadb269de..aa69515f32 100644
--- a/thread_pthread_mn.c
+++ b/thread_pthread_mn.c
@@ -174,8 +174,8 @@ nt_therad_stack_size(void)
rb_vm_t *vm = GET_VM();
int sz = (int)(vm->default_params.thread_vm_stack_size + vm->default_params.thread_machine_stack_size + MSTACK_PAGE_SIZE);
- int page_num = (sz + MSTACK_PAGE_SIZE - 1) / MSTACK_PAGE_SIZE;
- msz = page_num * MSTACK_PAGE_SIZE;
+ int page_num = roomof(sz, MSTACK_PAGE_SIZE);
+ msz = (size_t)page_num * MSTACK_PAGE_SIZE;
return msz;
}