Skip to content

Commit ab64b51

Browse files
committed
Revert "number casting: only keep Number::..."
This reverts commit ab10f66.
1 parent ab10f66 commit ab64b51

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed

src/main/kotlin/glm_/extensions.kt

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,95 @@ import kotlin.math.pow
1010
* Created by GBarbieri on 07.12.2016.
1111
*/
1212

13+
inline val Byte.f get() = toFloat()
14+
inline val Byte.b get() = toByte()
15+
inline val Byte.d get() = toDouble()
16+
inline val Byte.i get() = toInt()
17+
inline val Byte.L get() = toLong()
18+
inline val Byte.s get() = toShort()
19+
inline val Byte.ub get() = toUbyte()
20+
inline val Byte.ui get() = toUint()
21+
inline val Byte.ul get() = toUlong()
22+
inline val Byte.us get() = toUshort()
23+
inline val Byte.c get() = toInt().toChar()
24+
inline val Byte.bool get() = i != 0
25+
26+
inline val Short.f get() = toFloat()
27+
inline val Short.b get() = toByte()
28+
inline val Short.d get() = toDouble()
29+
inline val Short.i get() = toInt()
30+
inline val Short.L get() = toLong()
31+
inline val Short.s get() = toShort()
32+
inline val Short.ub get() = toUbyte()
33+
inline val Short.ui get() = toUint()
34+
inline val Short.ul get() = toUlong()
35+
inline val Short.us get() = toUshort()
36+
inline val Short.c get() = toInt().toChar()
37+
inline val Short.bool get() = i != 0
38+
39+
inline val Char.f get() = code.toFloat()
40+
inline val Char.b get() = code.toByte()
41+
inline val Char.d get() = code.toDouble()
42+
inline val Char.i get() = code
43+
inline val Char.L get() = code.toLong()
44+
inline val Char.s get() = code.toShort()
45+
inline val Char.ub get() = toUbyte()
46+
inline val Char.ui get() = toUint()
47+
inline val Char.ul get() = toUlong()
48+
inline val Char.us get() = toUshort()
49+
50+
inline val Int.f get() = toFloat()
51+
inline val Int.b get() = toByte()
52+
inline val Int.d get() = toDouble()
53+
inline val Int.i get() = toInt()
54+
inline val Int.L get() = toLong()
55+
inline val Int.s get() = toShort()
56+
inline val Int.ub get() = toUbyte()
57+
inline val Int.ui get() = toUint()
58+
inline val Int.ul get() = toUlong()
59+
inline val Int.us get() = toUshort()
60+
inline val Int.c get() = toChar()
61+
inline val Int.bool get() = i != 0
62+
63+
inline val Long.f get() = toFloat()
64+
inline val Long.b get() = toByte()
65+
inline val Long.d get() = toDouble()
66+
inline val Long.i get() = toInt()
67+
inline val Long.L get() = toLong()
68+
inline val Long.s get() = toShort()
69+
inline val Long.ub get() = toUbyte()
70+
inline val Long.ui get() = toUint()
71+
inline val Long.ul get() = toUlong()
72+
inline val Long.us get() = toUshort()
73+
inline val Long.c get() = toInt().toChar()
74+
inline val Long.bool get() = i != 0
75+
76+
inline val Float.f get() = toFloat()
77+
inline val Float.b get() = toInt().toByte()
78+
inline val Float.d get() = toDouble()
79+
inline val Float.i get() = toInt()
80+
inline val Float.L get() = toLong()
81+
inline val Float.s get() = toInt().toShort()
82+
inline val Float.ub get() = toUbyte()
83+
inline val Float.ui get() = toUint()
84+
inline val Float.ul get() = toUlong()
85+
inline val Float.us get() = toUshort()
86+
inline val Float.c get() = toInt().toChar()
87+
inline val Float.bool get() = i != 0
88+
89+
inline val Double.f get() = toFloat()
90+
inline val Double.b get() = toInt().toByte()
91+
inline val Double.d get() = toDouble()
92+
inline val Double.i get() = toInt()
93+
inline val Double.L get() = toLong()
94+
inline val Double.s get() = toInt().toShort()
95+
inline val Double.ub get() = toUbyte()
96+
inline val Double.ui get() = toUint()
97+
inline val Double.ul get() = toUlong()
98+
inline val Double.us get() = toUshort()
99+
inline val Double.c get() = toInt().toChar()
100+
inline val Double.bool get() = i != 0
101+
13102
inline val Number.f get() = toFloat()
14103
inline val Number.b get() = toByte()
15104
inline val Number.d get() = toDouble()

0 commit comments

Comments
 (0)