405 mv.visitInsn(Opcodes.ICONST_0 + value);
406 } else if (value >= Byte.MIN_VALUE && value <= Byte.MAX_VALUE) {
407 mv.visitIntInsn(Opcodes.BIPUSH, value);
408 } else if (value >= Short.MIN_VALUE && value <= Short.MAX_VALUE) {
409 mv.visitIntInsn(Opcodes.SIPUSH, value);
410 } else {
411 mv.visitLdcInsn(new Integer(value));
412 }
413 }
414
415 /**
416 * Generates the instruction to push the given value on the stack.
417 *
418 * @param value
419 * the value to be pushed on the stack.
420 */
421 public void push(final long value) {
422 if (value == 0L || value == 1L) {
423 mv.visitInsn(Opcodes.LCONST_0 + (int) value);
424 } else {
425 mv.visitLdcInsn(new Long(value));
426 }
427 }
428
429 /**
430 * Generates the instruction to push the given value on the stack.
431 *
432 * @param value
433 * the value to be pushed on the stack.
434 */
435 public void push(final float value) {
436 int bits = Float.floatToIntBits(value);
437 if (bits == 0L || bits == 0x3f800000 || bits == 0x40000000) { // 0..2
438 mv.visitInsn(Opcodes.FCONST_0 + (int) value);
439 } else {
440 mv.visitLdcInsn(new Float(value));
441 }
442 }
443
444 /**
445 * Generates the instruction to push the given value on the stack.
|
405 mv.visitInsn(Opcodes.ICONST_0 + value);
406 } else if (value >= Byte.MIN_VALUE && value <= Byte.MAX_VALUE) {
407 mv.visitIntInsn(Opcodes.BIPUSH, value);
408 } else if (value >= Short.MIN_VALUE && value <= Short.MAX_VALUE) {
409 mv.visitIntInsn(Opcodes.SIPUSH, value);
410 } else {
411 mv.visitLdcInsn(new Integer(value));
412 }
413 }
414
415 /**
416 * Generates the instruction to push the given value on the stack.
417 *
418 * @param value
419 * the value to be pushed on the stack.
420 */
421 public void push(final long value) {
422 if (value == 0L || value == 1L) {
423 mv.visitInsn(Opcodes.LCONST_0 + (int) value);
424 } else {
425 mv.visitLdcInsn(value);
426 }
427 }
428
429 /**
430 * Generates the instruction to push the given value on the stack.
431 *
432 * @param value
433 * the value to be pushed on the stack.
434 */
435 public void push(final float value) {
436 int bits = Float.floatToIntBits(value);
437 if (bits == 0L || bits == 0x3f800000 || bits == 0x40000000) { // 0..2
438 mv.visitInsn(Opcodes.FCONST_0 + (int) value);
439 } else {
440 mv.visitLdcInsn(new Float(value));
441 }
442 }
443
444 /**
445 * Generates the instruction to push the given value on the stack.
|