1 /* |
1 /* |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2013, 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. |
1540 // Dump TypeLong |
1540 // Dump TypeLong |
1541 #ifndef PRODUCT |
1541 #ifndef PRODUCT |
1542 static const char* longnamenear(jlong x, const char* xname, char* buf, jlong n) { |
1542 static const char* longnamenear(jlong x, const char* xname, char* buf, jlong n) { |
1543 if (n > x) { |
1543 if (n > x) { |
1544 if (n >= x + 10000) return NULL; |
1544 if (n >= x + 10000) return NULL; |
1545 sprintf(buf, "%s+" INT64_FORMAT, xname, n - x); |
1545 sprintf(buf, "%s+" JLONG_FORMAT, xname, n - x); |
1546 } else if (n < x) { |
1546 } else if (n < x) { |
1547 if (n <= x - 10000) return NULL; |
1547 if (n <= x - 10000) return NULL; |
1548 sprintf(buf, "%s-" INT64_FORMAT, xname, x - n); |
1548 sprintf(buf, "%s-" JLONG_FORMAT, xname, x - n); |
1549 } else { |
1549 } else { |
1550 return xname; |
1550 return xname; |
1551 } |
1551 } |
1552 return buf; |
1552 return buf; |
1553 } |
1553 } |
1555 static const char* longname(char* buf, jlong n) { |
1555 static const char* longname(char* buf, jlong n) { |
1556 const char* str; |
1556 const char* str; |
1557 if (n == min_jlong) |
1557 if (n == min_jlong) |
1558 return "min"; |
1558 return "min"; |
1559 else if (n < min_jlong + 10000) |
1559 else if (n < min_jlong + 10000) |
1560 sprintf(buf, "min+" INT64_FORMAT, n - min_jlong); |
1560 sprintf(buf, "min+" JLONG_FORMAT, n - min_jlong); |
1561 else if (n == max_jlong) |
1561 else if (n == max_jlong) |
1562 return "max"; |
1562 return "max"; |
1563 else if (n > max_jlong - 10000) |
1563 else if (n > max_jlong - 10000) |
1564 sprintf(buf, "max-" INT64_FORMAT, max_jlong - n); |
1564 sprintf(buf, "max-" JLONG_FORMAT, max_jlong - n); |
1565 else if ((str = longnamenear(max_juint, "maxuint", buf, n)) != NULL) |
1565 else if ((str = longnamenear(max_juint, "maxuint", buf, n)) != NULL) |
1566 return str; |
1566 return str; |
1567 else if ((str = longnamenear(max_jint, "maxint", buf, n)) != NULL) |
1567 else if ((str = longnamenear(max_jint, "maxint", buf, n)) != NULL) |
1568 return str; |
1568 return str; |
1569 else if ((str = longnamenear(min_jint, "minint", buf, n)) != NULL) |
1569 else if ((str = longnamenear(min_jint, "minint", buf, n)) != NULL) |
1570 return str; |
1570 return str; |
1571 else |
1571 else |
1572 sprintf(buf, INT64_FORMAT, n); |
1572 sprintf(buf, JLONG_FORMAT, n); |
1573 return buf; |
1573 return buf; |
1574 } |
1574 } |
1575 |
1575 |
1576 void TypeLong::dump2( Dict &d, uint depth, outputStream *st ) const { |
1576 void TypeLong::dump2( Dict &d, uint depth, outputStream *st ) const { |
1577 char buf[80], buf2[80]; |
1577 char buf[80], buf2[80]; |