fix padding
again
This commit is contained in:
@@ -40,10 +40,10 @@ fun ByteArray.padStart(
|
|||||||
padByte: Byte,
|
padByte: Byte,
|
||||||
): ByteArray {
|
): ByteArray {
|
||||||
return buildList {
|
return buildList {
|
||||||
repeat(length - size) {
|
repeat(length - this@padStart.size) {
|
||||||
add(padByte)
|
add(padByte)
|
||||||
}
|
}
|
||||||
addAll(this)
|
addAll(this@padStart)
|
||||||
}.toByteArray()
|
}.toByteArray()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,8 +52,8 @@ fun ByteArray.padEnd(
|
|||||||
padByte: Byte,
|
padByte: Byte,
|
||||||
): ByteArray {
|
): ByteArray {
|
||||||
return buildList {
|
return buildList {
|
||||||
addAll(this)
|
addAll(this@padEnd)
|
||||||
repeat(length - size) {
|
repeat(length - this@padEnd.size) {
|
||||||
add(padByte)
|
add(padByte)
|
||||||
}
|
}
|
||||||
}.toByteArray()
|
}.toByteArray()
|
||||||
|
|||||||
@@ -37,10 +37,10 @@ fun UByteArray.padStart(
|
|||||||
padByte: UByte,
|
padByte: UByte,
|
||||||
): UByteArray {
|
): UByteArray {
|
||||||
return buildList {
|
return buildList {
|
||||||
repeat(length - size) {
|
repeat(length - this@padStart.size) {
|
||||||
add(padByte)
|
add(padByte)
|
||||||
}
|
}
|
||||||
addAll(this)
|
addAll(this@padStart)
|
||||||
}.toUByteArray()
|
}.toUByteArray()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,8 +49,8 @@ fun UByteArray.padEnd(
|
|||||||
padByte: UByte,
|
padByte: UByte,
|
||||||
): UByteArray {
|
): UByteArray {
|
||||||
return buildList {
|
return buildList {
|
||||||
addAll(this)
|
addAll(this@padEnd)
|
||||||
repeat(length - size) {
|
repeat(length - this@padEnd.size) {
|
||||||
add(padByte)
|
add(padByte)
|
||||||
}
|
}
|
||||||
}.toUByteArray()
|
}.toUByteArray()
|
||||||
|
|||||||
Reference in New Issue
Block a user