summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorniklas <>1996-11-24 00:41:30 +0000
committerniklas <>1996-11-24 00:41:30 +0000
commite90ea8c1c340d369223ab48a99985c6b649e51c0 (patch)
treec39228577a70108e924254fb891a27b54343a26b
parent05500d62e522ee16732503e0c78e0040855392ca (diff)
downloadopenbsd-e90ea8c1c340d369223ab48a99985c6b649e51c0.tar.gz
openbsd-e90ea8c1c340d369223ab48a99985c6b649e51c0.tar.bz2
openbsd-e90ea8c1c340d369223ab48a99985c6b649e51c0.zip
more 64bit fixes
-rw-r--r--src/lib/libc/stdlib/malloc.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c
index 9111b092c7..1606ea6602 100644
--- a/src/lib/libc/stdlib/malloc.c
+++ b/src/lib/libc/stdlib/malloc.c
@@ -8,7 +8,7 @@
8 */ 8 */
9 9
10#if defined(LIBC_SCCS) && !defined(lint) 10#if defined(LIBC_SCCS) && !defined(lint)
11static char rcsid[] = "$OpenBSD: malloc.c,v 1.18 1996/11/23 19:10:26 niklas Exp $"; 11static char rcsid[] = "$OpenBSD: malloc.c,v 1.19 1996/11/24 00:41:30 niklas Exp $";
12#endif /* LIBC_SCCS and not lint */ 12#endif /* LIBC_SCCS and not lint */
13 13
14/* 14/*
@@ -396,7 +396,7 @@ map_pages(pages)
396 malloc_brk = tail; 396 malloc_brk = tail;
397 397
398 if ((last_index+1) >= malloc_ninfo && !extend_pgdir(last_index)) 398 if ((last_index+1) >= malloc_ninfo && !extend_pgdir(last_index))
399 return 0;; 399 return 0;
400 400
401 return result; 401 return result;
402} 402}
@@ -410,7 +410,7 @@ set_bit(pi, bit)
410 struct pginfo *pi; 410 struct pginfo *pi;
411 int bit; 411 int bit;
412{ 412{
413 pi->bits[bit/MALLOC_BITS] |= 1<<(bit%MALLOC_BITS); 413 pi->bits[bit/MALLOC_BITS] |= 1UL<<(bit%MALLOC_BITS);
414} 414}
415#endif /* set_bit */ 415#endif /* set_bit */
416 416
@@ -423,7 +423,7 @@ clr_bit(pi, bit)
423 struct pginfo *pi; 423 struct pginfo *pi;
424 int bit; 424 int bit;
425{ 425{
426 pi->bits[bit/MALLOC_BITS] &= ~(1<<(bit%MALLOC_BITS)); 426 pi->bits[bit/MALLOC_BITS] &= ~(1UL<<(bit%MALLOC_BITS));
427} 427}
428#endif /* clr_bit */ 428#endif /* clr_bit */
429 429
@@ -436,7 +436,7 @@ tst_bit(pi, bit)
436 struct pginfo *pi; 436 struct pginfo *pi;
437 int bit; 437 int bit;
438{ 438{
439 return pi->bits[bit/MALLOC_BITS] & (1<<(bit%MALLOC_BITS)); 439 return pi->bits[bit/MALLOC_BITS] & (1UL<<(bit%MALLOC_BITS));
440} 440}
441#endif /* tst_bit */ 441#endif /* tst_bit */
442 442
@@ -446,7 +446,7 @@ tst_bit(pi, bit)
446#ifndef fls 446#ifndef fls
447static __inline int 447static __inline int
448fls(size) 448fls(size)
449 int size; 449 size_t size;
450{ 450{
451 int i = 1; 451 int i = 1;
452 while (size >>= 1) 452 while (size >>= 1)
@@ -455,7 +455,7 @@ fls(size)
455} 455}
456#endif /* fls */ 456#endif /* fls */
457 457
458#if LONG_BITS == WORD_BITS 458#if LONG_BIT == WORD_BIT
459#define ffs_ul ffs 459#define ffs_ul ffs
460#else 460#else
461static __inline int 461static __inline int
@@ -474,6 +474,7 @@ ffs_ul(u_long ul)
474 } 474 }
475 if (k) 475 if (k)
476 k += i * sizeof (u_int) * 8; 476 k += i * sizeof (u_int) * 8;
477 return k;
477} 478}
478#endif 479#endif
479 480
@@ -485,7 +486,8 @@ extend_pgdir(index)
485 u_long index; 486 u_long index;
486{ 487{
487 struct pginfo **new, **old; 488 struct pginfo **new, **old;
488 int i, oldlen; 489 int i;
490 size_t oldlen;
489 491
490 /* Make it this many pages */ 492 /* Make it this many pages */
491 i = index * sizeof *page_dir; 493 i = index * sizeof *page_dir;
@@ -788,7 +790,7 @@ malloc_make_chunks(bits)
788 (((malloc_pagesize >> bits)+MALLOC_BITS-1) / MALLOC_BITS); 790 (((malloc_pagesize >> bits)+MALLOC_BITS-1) / MALLOC_BITS);
789 791
790 /* Don't waste more than two chunks on this */ 792 /* Don't waste more than two chunks on this */
791 if ((1<<(bits)) <= l+l) { 793 if ((1UL<<(bits)) <= l+l) {
792 bp = (struct pginfo *)pp; 794 bp = (struct pginfo *)pp;
793 } else { 795 } else {
794 bp = (struct pginfo *)imalloc(l); 796 bp = (struct pginfo *)imalloc(l);
@@ -796,7 +798,7 @@ malloc_make_chunks(bits)
796 return 0; 798 return 0;
797 } 799 }
798 800
799 bp->size = (1<<bits); 801 bp->size = (1UL<<bits);
800 bp->shift = bits; 802 bp->shift = bits;
801 bp->total = bp->free = malloc_pagesize >> bits; 803 bp->total = bp->free = malloc_pagesize >> bits;
802 bp->page = pp; 804 bp->page = pp;