01: // Copyright (c) 1997 Per M.A. Bothner.
02: // This is free software; for terms and warranty disclaimer see ./COPYING.
03:
04: package gnu.bytecode;
05:
06: import java.io.*;
07:
08: /** A CONSTANT_Float entry in the constant pool. */
09:
10: public class CpoolFloat extends CpoolEntry {
11: float value;
12:
13: CpoolFloat(ConstantPool cpool, int h, float val) {
14: super (cpool, h);
15: value = val;
16: ++cpool.count;
17: }
18:
19: public int getTag() {
20: return 4;
21: } // CONSTANT_Float
22:
23: final static int hashCode(float val) {
24: return (int) val;
25: }
26:
27: void write(DataOutputStream dstr) throws java.io.IOException {
28: dstr.writeByte(4); // CONSTANT_Float
29: dstr.writeFloat(value);
30: }
31:
32: public void print(ClassTypeWriter dst, int verbosity) {
33: if (verbosity > 0)
34: dst.print("Float ");
35: dst.print(value);
36: if (verbosity > 1) {
37: dst.print("=0x");
38: dst.print(Integer.toHexString(Float.floatToIntBits(value)));
39: }
40: }
41: }
|