1 // -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
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
;
15 * Functions for {@link MathShelf}.
20 implements MLEFunction
22 /** {@link MathShelf#longPack(int, int)}. */
23 LONG_PACK("longPack:(II)J")
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")
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")
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")
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")
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")
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")
114 public Object
handle(SpringThreadWorker __thread
, Object
... __args
)
116 return Double
.longBitsToDouble((long)__args
[0]);
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.
133 MLEMath(String __key
)
134 throws NullPointerException
137 throw new NullPointerException("NARG");