Skip to content

Commit eb79193

Browse files
committed
style: formatting
1 parent de22c34 commit eb79193

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

src/commonMain/kotlin/com/eignex/kencode/BaseRadix.kt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ open class BaseRadix(private val alphabet: Alphabet, val blockSize: Int = 32) :
8787
private val zeroChar: Char get() = alphabet[0]
8888

8989
private val isMassiveBase = alphabet.size > 256
90+
9091
// Full block length must exceed any partial block's so the decoder can split unambiguously.
9192
private val massiveFullBlockLen: Int = maxOf(
9293
ceil((blockSize * 8) / logBase).toInt(),
@@ -233,8 +234,11 @@ open class BaseRadix(private val alphabet: Alphabet, val blockSize: Int = 32) :
233234
var l = from
234235
var r = to - 1
235236
while (l < r) {
236-
val tmp = this[l]; this[l] = this[r]; this[r] = tmp
237-
l++; r--
237+
val tmp = this[l]
238+
this[l] = this[r]
239+
this[r] = tmp
240+
l++
241+
r--
238242
}
239243
}
240244

@@ -290,7 +294,13 @@ open class BaseRadix(private val alphabet: Alphabet, val blockSize: Int = 32) :
290294
}
291295

292296
val bytes = n.toByteArray()
293-
val actualBytes = if (bytes.size > 1 && bytes[0] == 0.toByte()) bytes.sliceArray(1 until bytes.size) else bytes
297+
val actualBytes = if (bytes.size > 1 && bytes[0] == 0.toByte()) {
298+
bytes.sliceArray(
299+
1 until bytes.size
300+
)
301+
} else {
302+
bytes
303+
}
294304

295305
actualBytes.copyInto(output, outPos)
296306
outPos += actualBytes.size

src/commonTest/kotlin/com/eignex/kencode/BaseRadixTest.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,11 @@ class BaseRadixTest {
257257
fun `massive bases handle high bit bytes without sign corruption`() {
258258
val codec = BaseRadix(UnicodeRangeAlphabet())
259259
val input = byteArrayOf(
260-
0xFF.toByte(), 0x80.toByte(), 0x7F.toByte(), 0x00, 0xFF.toByte()
260+
0xFF.toByte(),
261+
0x80.toByte(),
262+
0x7F.toByte(),
263+
0x00,
264+
0xFF.toByte()
261265
)
262266
assertRoundtrip(codec, input, "High bit bytes failed on massive base")
263267
}

0 commit comments

Comments
 (0)