Skip to content

Commit b9cb76c

Browse files
committed
Address more review points
1 parent f359d50 commit b9cb76c

File tree

5 files changed

+7
-9
lines changed

5 files changed

+7
-9
lines changed

core/common/src/internal/math.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55

66
package kotlinx.datetime.internal
77

8-
import kotlin.native.concurrent.*
9-
108
internal fun Long.clampToInt(): Int =
119
when {
1210
this > Int.MAX_VALUE -> Int.MAX_VALUE
@@ -182,7 +180,6 @@ internal fun multiplyAndAdd(d: Long, n: Long, r: Long): Long {
182180
return safeAdd(safeMultiply(md, n), mr)
183181
}
184182

185-
@ThreadLocal
186183
internal val POWERS_OF_TEN = intArrayOf(
187184
1,
188185
10,
@@ -235,4 +232,10 @@ internal class DecimalFraction(
235232
append('.')
236233
append((denominator + (fractionalPart % denominator)).toString().removePrefix("1"))
237234
}
235+
236+
override fun hashCode(): Int {
237+
var result = fractionalPart
238+
result = 31 * result + digits
239+
return result
240+
}
238241
}

core/common/src/internal/Repr.kt renamed to core/common/src/internal/toKotlinCode.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,3 @@ internal fun Char.toKotlinCode(): String = when (this) {
2525
'\'' -> "'\\''"
2626
else -> "'$this'"
2727
}
28-
29-
internal fun<T> List<T>.toKotlinCode(elementRepr: T.() -> String): String =
30-
joinToString(", ", "listOf(", ")") { it.elementRepr() }

core/native/src/UtcOffset.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import kotlinx.datetime.format.*
1010
import kotlinx.datetime.serializers.UtcOffsetSerializer
1111
import kotlinx.serialization.Serializable
1212
import kotlin.math.abs
13-
import kotlin.native.concurrent.ThreadLocal
1413

1514
@Serializable(with = UtcOffsetSerializer::class)
1615
public actual class UtcOffset private constructor(public actual val totalSeconds: Int) {
@@ -98,7 +97,6 @@ public actual class UtcOffset private constructor(public actual val totalSeconds
9897

9998
}
10099

101-
@ThreadLocal
102100
private var utcOffsetCache: MutableMap<Int, UtcOffset> = mutableMapOf(0 to UtcOffset.ZERO)
103101

104102
@Suppress("ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS")

core/native/test/ThreeTenBpLocalDateTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class ThreeTenBpLocalDateTest {
1616

1717
@Test
1818
fun dayOfWeek() {
19-
var dow = kotlinx.datetime.DayOfWeek.MONDAY
19+
var dow = DayOfWeek.MONDAY
2020
for (month in 1..12) {
2121
val length = month.monthLength(false)
2222
for (i in 1..length) {

0 commit comments

Comments
 (0)