1 /* |
1 /* |
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
186 } else { |
186 } else { |
187 return "B"; |
187 return "B"; |
188 } |
188 } |
189 } |
189 } |
190 |
190 |
191 inline size_t byte_size_in_proper_unit(size_t s) { |
191 template <class T> |
|
192 inline T byte_size_in_proper_unit(T s) { |
192 if (s >= 10*M) { |
193 if (s >= 10*M) { |
193 return s/M; |
194 return (T)(s/M); |
194 } else if (s >= 10*K) { |
195 } else if (s >= 10*K) { |
195 return s/K; |
196 return (T)(s/K); |
196 } else { |
197 } else { |
197 return s; |
198 return s; |
198 } |
199 } |
199 } |
200 } |
200 |
|
201 |
201 |
202 //---------------------------------------------------------------------------------------------------- |
202 //---------------------------------------------------------------------------------------------------- |
203 // VM type definitions |
203 // VM type definitions |
204 |
204 |
205 // intx and uintx are the 'extended' int and 'extended' unsigned int types; |
205 // intx and uintx are the 'extended' int and 'extended' unsigned int types; |