LEFT | RIGHT |
(Both sides are equal) |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 // Malloc small size classes. | 5 // Malloc small size classes. |
6 // | 6 // |
7 // See malloc.h for overview. | 7 // See malloc.h for overview. |
8 // | 8 // |
9 // The size classes are chosen so that rounding an allocation | 9 // The size classes are chosen so that rounding an allocation |
10 // request up to the next size class wastes at most 12.5% (1.125x). | 10 // request up to the next size class wastes at most 12.5% (1.125x). |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 if(size < MaxSmallSize) { | 175 if(size < MaxSmallSize) { |
176 if(size <= 1024-8) | 176 if(size <= 1024-8) |
177 return runtime·class_to_size[runtime·size_to_class8[(siz
e+7)>>3]]; | 177 return runtime·class_to_size[runtime·size_to_class8[(siz
e+7)>>3]]; |
178 else | 178 else |
179 return runtime·class_to_size[runtime·size_to_class128[(s
ize-1024+127) >> 7]]; | 179 return runtime·class_to_size[runtime·size_to_class128[(s
ize-1024+127) >> 7]]; |
180 } | 180 } |
181 if(size + PageSize < size) | 181 if(size + PageSize < size) |
182 return size; | 182 return size; |
183 return ROUND(size, PageSize); | 183 return ROUND(size, PageSize); |
184 } | 184 } |
LEFT | RIGHT |