From f51e5da5728f91b380790f6a658b124bdb5821a5 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Mon, 6 Apr 2026 22:48:19 +0900 Subject: [PATCH] Fix calloc-transposed-args warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` ntt.h: In function ‘ntt_multiply’: ntt.h:136:41: warning: ‘ruby_xcalloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Wcalloc-transposed-args] 136 | uint32_t *mem = ruby_xcalloc(sizeof(uint32_t), ntt_size * 9); | ^~~~~~~~ ntt.h:136:41: note: earlier argument should specify number of elements, later size of each element ``` --- ext/bigdecimal/ntt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/bigdecimal/ntt.h b/ext/bigdecimal/ntt.h index 4519459d..42b9bd47 100644 --- a/ext/bigdecimal/ntt.h +++ b/ext/bigdecimal/ntt.h @@ -133,7 +133,7 @@ ntt_multiply(size_t a_size, size_t b_size, uint32_t *a, uint32_t *b, uint32_t *c uint32_t batch_size = ntt_size - (uint32_t)b_size; uint32_t batch_count = (uint32_t)((a_size + batch_size - 1) / batch_size); - uint32_t *mem = ruby_xcalloc(sizeof(uint32_t), ntt_size * 9); + uint32_t *mem = ruby_xcalloc(ntt_size * 9, sizeof(uint32_t)); uint32_t *ntt1 = mem; uint32_t *ntt2 = mem + ntt_size; uint32_t *ntt3 = mem + ntt_size * 2;