From e8ae5265bcab9914a08166841f8201ef1ae6dcce Mon Sep 17 00:00:00 2001 From: spinute Date: Sun, 4 Sep 2016 22:34:22 +0900 Subject: [PATCH] fix compile error of clang --- hash.c | 4 ++-- st.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hash.c b/hash.c index 5e1d7f262cb476..c3aac1a2bd3dc9 100644 --- a/hash.c +++ b/hash.c @@ -271,7 +271,7 @@ key64_hash (uint64_t key, uint32_t seed) long rb_objid_hash(st_index_t index) { - return key64_hash (index, prime2); + return key64_hash (index, (uint32_t)prime2); } static st_index_t @@ -315,7 +315,7 @@ rb_ident_hash(st_data_t n) } #endif - return (st_index_t) key64_hash((st_index_t)n, prime2); + return (st_index_t) key64_hash((st_index_t)n, (uint32_t)prime2); } static const struct st_hash_type identhash = { diff --git a/st.c b/st.c index 8041351d920165..5f447c7bec1304 100644 --- a/st.c +++ b/st.c @@ -347,7 +347,7 @@ get_power2(st_index_t size) { /* Return value of N-th bin in array BINS of table with bins size index S. */ static inline st_index_t -get_bin(st_index_t *bins, int s, st_index_t n) { +get_bin(st_index_t *bins, st_index_t s, st_index_t n) { return (s == 0 ? ((unsigned char *) bins)[n] : s == 1 ? ((unsigned short *) bins)[n] : s == 2 ? ((unsigned int *) bins)[n] @@ -357,10 +357,10 @@ get_bin(st_index_t *bins, int s, st_index_t n) { /* Set up N-th bin in array BINS of table with bins size index S to value V. */ static inline void -set_bin(st_index_t *bins, int s, st_index_t n, st_index_t v) { +set_bin(st_index_t *bins, st_index_t s, st_index_t n, st_index_t v) { if (s == 0) ((unsigned char *) bins)[n] = v; else if (s == 1) ((unsigned short *) bins)[n] = v; - else if (s == 2) ((unsigned int *) bins)[n] = v; + else if (s == 2) ((unsigned int *) bins)[n] = (unsigned int)v; else ((st_index_t *) bins)[n] = v; }