aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc/search/hcreate_r.c
diff options
context:
space:
mode:
authorJozef Lawrynowicz <jozef.l@mittosystems.com>2020-09-02 15:50:07 +0100
committerCorinna Vinschen <corinna@vinschen.de>2020-09-03 12:55:32 +0200
commit754386c7f558a686420d4646c101706d9020f5d3 (patch)
tree2b40e3a34f5e8a414da75e1191bd67ed2d01d719 /newlib/libc/search/hcreate_r.c
parenta634adda5af00c5936e3e7a5e2950c05c14981d3 (diff)
downloadnewlib-754386c7f558a686420d4646c101706d9020f5d3.zip
newlib-754386c7f558a686420d4646c101706d9020f5d3.tar.gz
newlib-754386c7f558a686420d4646c101706d9020f5d3.tar.bz2
Fix warnings when building for msp430-elf
The MSP430 target supports both 16-bit and 20-bit size_t and intptr_t. Some implicit casts in Newlib expect these types to be "long", (a 32-bit type on MSP430) which causes warnings during compilation such as: "cast from pointer to integer of different size"
Diffstat (limited to 'newlib/libc/search/hcreate_r.c')
-rw-r--r--newlib/libc/search/hcreate_r.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/newlib/libc/search/hcreate_r.c b/newlib/libc/search/hcreate_r.c
index 8aba524..400a57f 100644
--- a/newlib/libc/search/hcreate_r.c
+++ b/newlib/libc/search/hcreate_r.c
@@ -72,7 +72,12 @@ SLIST_HEAD(internal_head, internal_entry);
* max * sizeof internal_entry must fit into size_t.
* assumes internal_entry is <= 32 (2^5) bytes.
*/
+#ifdef __MSP430X_LARGE__
+/* 20-bit size_t. */
+#define MAX_BUCKETS_LG2 (20 - 1 - 5)
+#else
#define MAX_BUCKETS_LG2 (sizeof (size_t) * 8 - 1 - 5)
+#endif
#define MAX_BUCKETS ((size_t)1 << MAX_BUCKETS_LG2)
/* Default hash function, from db/hash/hash_func.c */