org.hnau.emitter.extensions.byte.EmitterByteWithShortExtensions.kt Maven / Gradle / Ivy
package org.hnau.emitter.extensions.byte
import org.hnau.emitter.Emitter
import org.hnau.emitter.extensions.map
import org.hnau.emitter.observing.content.combine.combineWith
fun Emitter.toShort() = map(Byte::toShort)
operator fun Emitter.plus(other: Emitter) = combineWith(other, Byte::plus)
operator fun Emitter.minus(other: Emitter) = combineWith(other, Byte::minus)
operator fun Emitter.times(other: Emitter) = combineWith(other, Byte::times)
operator fun Emitter.div(other: Emitter) = combineWith(other, Byte::div)
operator fun Emitter.rem(other: Emitter) = combineWith(other, Byte::rem)
operator fun Emitter.rangeTo(other: Emitter) = combineWith(other, Byte::rangeTo)
operator fun Emitter.plus(other: Short) = map { it + other }
operator fun Emitter.minus(other: Short) = map { it - other }
operator fun Emitter.times(other: Short) = map { it * other }
operator fun Emitter.div(other: Short) = map { it / other }
operator fun Emitter.rem(other: Short) = map { it % other }
operator fun Emitter.rangeTo(other: Short) = map { it .. other }
operator fun Byte.plus(other: Emitter) = other.map { this + it }
operator fun Byte.minus(other: Emitter) = other.map { this - it }
operator fun Byte.times(other: Emitter) = other.map { this * it }
operator fun Byte.div(other: Emitter) = other.map { this / it }
operator fun Byte.rem(other: Emitter) = other.map { this % it }
operator fun Byte.rangeTo(other: Emitter) = other.map { this .. it }
© 2015 - 2025 Weber Informatics LLC | Privacy Policy