Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: fusl/src/malloc/malloc.c

Issue 1576423004: Remove -Wno-shift-op-parentheses for fusl build (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #define _GNU_SOURCE 1 #define _GNU_SOURCE
2 #include <stdlib.h> 2 #include <stdlib.h>
3 #include <string.h> 3 #include <string.h>
4 #include <limits.h> 4 #include <limits.h>
5 #include <stdint.h> 5 #include <stdint.h>
6 #include <errno.h> 6 #include <errno.h>
7 #include <sys/mman.h> 7 #include <sys/mman.h>
8 #include "libc.h" 8 #include "libc.h"
9 #include "atomic.h" 9 #include "atomic.h"
10 #include "pthread_impl.h" 10 #include "pthread_impl.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 x = x / SIZE_ALIGN - 1; 116 x = x / SIZE_ALIGN - 1;
117 if (x <= 32) return x; 117 if (x <= 32) return x;
118 if (x > 0x1c00) return 63; 118 if (x > 0x1c00) return 63;
119 return ((union { float v; uint32_t r; }){(int)x}.r>>21) - 496; 119 return ((union { float v; uint32_t r; }){(int)x}.r>>21) - 496;
120 } 120 }
121 121
122 static int bin_index_up(size_t x) 122 static int bin_index_up(size_t x)
123 { 123 {
124 x = x / SIZE_ALIGN - 1; 124 x = x / SIZE_ALIGN - 1;
125 if (x <= 32) return x; 125 if (x <= 32) return x;
126 » return ((union { float v; uint32_t r; }){(int)x}.r+0x1fffff>>21) - 496; 126 » return (((union { float v; uint32_t r; }){(int)x}.r+0x1fffff)>>21) - 496 ;
viettrungluu 2016/01/12 18:40:02 What is this I don't even....
127 } 127 }
128 128
129 #if 0 129 #if 0
130 void __dump_heap(int x) 130 void __dump_heap(int x)
131 { 131 {
132 struct chunk *c; 132 struct chunk *c;
133 int i; 133 int i;
134 for (c = (void *)mal.heap; CHUNK_SIZE(c); c = NEXT_CHUNK(c)) 134 for (c = (void *)mal.heap; CHUNK_SIZE(c); c = NEXT_CHUNK(c))
135 fprintf(stderr, "base %p size %zu (%d) flags %d/%d\n", 135 fprintf(stderr, "base %p size %zu (%d) flags %d/%d\n",
136 c, CHUNK_SIZE(c), bin_index(CHUNK_SIZE(c)), 136 c, CHUNK_SIZE(c), bin_index(CHUNK_SIZE(c)),
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 #if 1 512 #if 1
513 __madvise((void *)a, b-a, MADV_DONTNEED); 513 __madvise((void *)a, b-a, MADV_DONTNEED);
514 #else 514 #else
515 __mmap((void *)a, b-a, PROT_READ|PROT_WRITE, 515 __mmap((void *)a, b-a, PROT_READ|PROT_WRITE,
516 MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED, -1, 0); 516 MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED, -1, 0);
517 #endif 517 #endif
518 } 518 }
519 519
520 unlock_bin(i); 520 unlock_bin(i);
521 } 521 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698