01: /* Soot - a J*va Optimization Framework
02: * Copyright (C) 1997 Clark Verbrugge
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2.1 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the
16: * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17: * Boston, MA 02111-1307, USA.
18: */
19:
20: /*
21: * Modified by the Sable Research Group and others 1997-1999.
22: * See the 'credits' file distributed with Soot for the complete list of
23: * contributors. (Soot is distributed at http://www.sable.mcgill.ca/soot)
24: */
25:
26: package soot.coffi;
27:
28: /** A constant pool entry of type CONSTANT_Long
29: * @see cp_info
30: * @author Clark Verbrugge
31: */
32: class CONSTANT_Long_info extends cp_info {
33: /** the upper 32 bits of the long. */
34: public long high;
35: /** the lower 32 bits of the long. */
36: public long low;
37:
38: /** Returns the size of this cp_info object.
39: * @return number of bytes occupied by this object.
40: * @see cp_info#size
41: */
42: public int size() {
43: return 9;
44: }
45:
46: /** Converts the internal two-int representation to an actual long. */
47: public long convert() {
48: return ints2long(high, low);
49: }
50:
51: /** Returns a String representation of this entry.
52: * @param constant_pool constant pool of ClassFile.
53: * @return String representation of this entry.
54: * @see cp_info#toString
55: */
56: public String toString(cp_info constant_pool[]) {
57: return "(" + high + "," + low + ") = "
58: + Long.toString(convert());
59: }
60:
61: /** Returns a String description of what kind of entry this is.
62: * @return the String "long".
63: * @see cp_info#typeName
64: */
65: public String typeName() {
66: return "long";
67: }
68:
69: /** Compares this entry with another cp_info object (which may reside
70: * in a different constant pool).
71: * @param constant_pool constant pool of ClassFile for this.
72: * @param cp constant pool entry to compare against.
73: * @param cp_constant_pool constant pool of ClassFile for cp.
74: * @return a value <0, 0, or >0 indicating whether this is smaller,
75: * the same or larger than cp.
76: * @see cp_info#compareTo
77: */
78: public int compareTo(cp_info constant_pool[], cp_info cp,
79: cp_info cp_constant_pool[]) {
80: long d;
81: if (tag != cp.tag)
82: return tag - cp.tag;
83: CONSTANT_Long_info cu = (CONSTANT_Long_info) cp;
84: d = convert() - cu.convert();
85: return ((d > 0) ? 1 : ((d < 0) ? -1 : 0));
86: }
87: }
|