Remove Assembly.
[SquirrelJME.git] / emulators / springcoat-vm / src / main / java / cc / squirreljme / vm / springcoat / MLEMath.java
blob51c78b3dc59915355c0430d651e70196176aac7b
1 // -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
3 // SquirrelJME
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the GNU General Public License v3+, or later.
7 // See license.mkd for licensing and copyright information.
8 // ---------------------------------------------------------------------------
10 package cc.squirreljme.vm.springcoat;
12 import cc.squirreljme.jvm.mle.MathShelf;
14 /**
15 * Functions for {@link MathShelf}.
17 * @since 2020/06/18
19 public enum MLEMath
20 implements MLEFunction
22 /** {@link MathShelf#longPack(int, int)}. */
23 LONG_PACK("longPack:(II)J")
25 /**
26 * {@inheritDoc}
27 * @since 2023/05/30
29 @Override
30 public Object handle(SpringThreadWorker __thread, Object... __args)
32 return MathShelf.longPack((int)__args[0], (int)__args[1]);
36 /** {@link MathShelf#longUnpackHigh(long)}. */
37 LONG_UNPACK_HIGH("longUnpackHigh:(J)I")
39 /**
40 * {@inheritDoc}
41 * @since 2023/05/30
43 @Override
44 public Object handle(SpringThreadWorker __thread, Object... __args)
46 return MathShelf.longUnpackHigh((long)__args[0]);
50 /** {@link MathShelf#longUnpackLow(long)}. */
51 LONG_UNPACK_LOW("longUnpackLow:(J)I")
53 /**
54 * {@inheritDoc}
55 * @since 2023/05/30
57 @Override
58 public Object handle(SpringThreadWorker __thread, Object... __args)
60 return MathShelf.longUnpackLow((long)__args[0]);
64 /** {@link MathShelf#rawDoubleToLong(double)}. */
65 RAW_DOUBLE_TO_LONG("rawDoubleToLong:(D)J")
67 /**
68 * {@inheritDoc}
69 * @since 2020/06/18
71 @Override
72 public Object handle(SpringThreadWorker __thread, Object... __args)
74 return Double.doubleToRawLongBits((double)__args[0]);
78 /** {@link MathShelf#rawFloatToInt(float)}. */
79 RAW_FLOAT_TO_INT("rawFloatToInt:(F)I")
81 /**
82 * {@inheritDoc}
83 * @since 2020/06/18
85 @Override
86 public Object handle(SpringThreadWorker __thread, Object... __args)
88 return Float.floatToRawIntBits((float)__args[0]);
92 /** {@link MathShelf#rawIntToFloat(int)}. */
93 RAW_INT_TO_FLOAT("rawIntToFloat:(I)F")
95 /**
96 * {@inheritDoc}
97 * @since 2020/06/18
99 @Override
100 public Object handle(SpringThreadWorker __thread, Object... __args)
102 return Float.intBitsToFloat((int)__args[0]);
106 /** {@link MathShelf#rawLongToDouble(long)}. */
107 RAW_LONG_TO_DOUBLE("rawLongToDouble:(J)D")
110 * {@inheritDoc}
111 * @since 2020/06/18
113 @Override
114 public Object handle(SpringThreadWorker __thread, Object... __args)
116 return Double.longBitsToDouble((long)__args[0]);
120 /* End. */
123 /** The dispatch key. */
124 protected final String key;
127 * Initializes the dispatcher info.
129 * @param __key The key.
130 * @throws NullPointerException On null arguments.
131 * @since 2020/06/18
133 MLEMath(String __key)
134 throws NullPointerException
136 if (__key == null)
137 throw new NullPointerException("NARG");
139 this.key = __key;
143 * {@inheritDoc}
144 * @since 2020/06/18
146 @Override
147 public String key()
149 return this.key;