Skip to content

Commit

Permalink
Update Buffer.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgCantor authored Oct 5, 2024
1 parent b78d9f4 commit 22c94bb
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions okio/src/commonMain/kotlin/okio/internal/Buffer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -462,23 +462,24 @@ internal inline fun Buffer.commonWriteDecimalLong(v: Long): Buffer {
}

val width = when {
v < 10 -> 1
v < 100 -> 2
v < 1_000 -> 3
v < 10_000 -> 4
v < 100_000 -> 5
v < 1_000_000 -> 6
v < 10_000_000 -> 7
v < 100_000_000 -> 8
v < 1_000_000_000 -> 9
v < 10_000_000_000 -> 10
v < 100_000_000_000 -> 11
v < 1_000_000_000_000 -> 12
v < 10_000_000_000_000 -> 13
v < 100_000_000_000_000 -> 14
v < 1_000_000_000_000_000 -> 15
v < 10_000_000_000_000_000 -> 16
v < 100_000_000_000_000_000 -> 17
v < 10L -> 1
v < 100L -> 2
v < 1_000L -> 3
v < 10_000L -> 4
v < 100_000L -> 5
v < 1_000_000L -> 6
v < 10_000_000L -> 7
v < 100_000_000L -> 8
v < 1_000_000_000L -> 9
v < 10_000_000_000L -> 10
v < 100_000_000_000L -> 11
v < 1_000_000_000_000L -> 12
v < 10_000_000_000_000L -> 13
v < 100_000_000_000_000L -> 14
v < 1_000_000_000_000_000L -> 15
v < 10_000_000_000_000_000L -> 16
v < 100_000_000_000_000_000L -> 17
v < 1_000_000_000_000_000_000L -> 18
else -> 19
} + if (negative) 1 else 0

Expand Down

0 comments on commit 22c94bb

Please sign in to comment.