Compare commits

...
2 Commits
Author SHA1 Message Date
Infendro 33d118430d bump version to 1.1.0
/ publish (push) Successful in 2m35s
2025-07-24 20:30:16 +02:00
Infendro 9efcd0e695 implement bitwise operations 2025-07-24 20:30:00 +02:00
2 changed files with 36 additions and 1 deletions

No files matched your search

+1 -1
View File
@@ -1,5 +1,5 @@
group = "com.infendro" group = "com.infendro"
version = "1.0.0" version = "1.1.0"
repositories { repositories {
mavenCentral() mavenCentral()
@@ -0,0 +1,35 @@
package com.infendro.bytearray
import kotlin.experimental.and
import kotlin.experimental.or
import kotlin.experimental.xor
infix fun ByteArray.and(
that: ByteArray,
): ByteArray {
if (this.size != that.size) throw Exception()
return ByteArray(size) { i ->
this[i] and that[i]
}
}
infix fun ByteArray.or(
that: ByteArray,
): ByteArray {
if (this.size != that.size) throw Exception()
return ByteArray(size) { i ->
this[i] or that[i]
}
}
infix fun ByteArray.xor(
that: ByteArray,
): ByteArray {
if (this.size != that.size) throw Exception()
return ByteArray(size) { i ->
this[i] xor that[i]
}
}