Skip to content

Commit 09f8500

Browse files
committed
vec1i operators
1 parent 4c1cce5 commit 09f8500

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

src/main/kotlin/glm_/vec1/Vec1i.kt

+49
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,57 @@ class Vec1i(x: Int) : Vec1t<Int>(x) {
124124
}
125125

126126

127+
// -- Specific binary arithmetic operators --
128+
129+
infix operator fun plus(b: Int) = plus(Vec1i(), this, b)
130+
infix operator fun plus(b: Vec1i) = plus(Vec1i(), this, b.x)
131+
132+
fun plus(b: Int, res: Vec1i) = plus(res, this, b)
133+
fun plus(b: Vec1i, res: Vec1i) = plus(res, this, b.x)
134+
135+
infix fun plus_(b: Int) = plus(this, this, b)
136+
infix fun plus_(b: Vec1i) = plus(this, this, b.x)
137+
138+
139+
infix operator fun minus(b: Int) = minus(Vec1i(), this, b)
140+
infix operator fun minus(b: Vec1i) = minus(Vec1i(), this, b.x)
141+
142+
fun minus(b: Int, res: Vec1i) = minus(res, this, b)
143+
fun minus(b: Vec1i, res: Vec1i) = minus(res, this, b.x)
144+
145+
infix fun minus_(b: Int) = minus(this, this, b)
146+
infix fun minus_(b: Vec1i) = minus(this, this, b.x)
147+
148+
149+
infix operator fun times(b: Int) = times(Vec1i(), this, b)
150+
infix operator fun times(b: Vec1i) = times(Vec1i(), this, b.x)
151+
152+
fun times(b: Int, res: Vec1i) = times(res, this, b)
153+
fun times(b: Vec1i, res: Vec1i) = times(res, this, b.x)
154+
155+
infix fun times_(b: Int) = times(this, this, b)
156+
infix fun times_(b: Vec1i) = times(this, this, b.x)
157+
158+
159+
infix operator fun div(b: Int) = div(Vec1i(), this, b)
160+
infix operator fun div(b: Vec1i) = div(Vec1i(), this, b.x)
161+
162+
fun div(b: Int, res: Vec1i) = div(res, this, b)
127163
fun div(b: Vec1i, res: Vec1i) = div(res, this, b.x)
128164

165+
infix fun div_(b: Int) = div(this, this, b)
166+
infix fun div_(b: Vec1i) = div(this, this, b.x)
167+
168+
169+
infix operator fun rem(b: Int) = rem(Vec1i(), this, b)
170+
infix operator fun rem(b: Vec1i) = rem(Vec1i(), this, b.x)
171+
172+
fun rem(b: Int, res: Vec1i) = rem(res, this, b)
173+
fun rem(b: Vec1i, res: Vec1i) = rem(res, this, b.x)
174+
175+
infix fun rem_(b: Int) = rem(this, this, b)
176+
infix fun rem_(b: Vec1i) = rem(this, this, b.x)
177+
129178

130179
override fun equals(other: Any?) = other is Vec1i && this[0] == other[0]
131180
override fun hashCode() = x.hashCode()

0 commit comments

Comments
 (0)