Skip to content

Commit 845b93b

Browse files
committed
LazyVals: fix long shifts.
1 parent cbb565a commit 845b93b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/dotty/runtime/LazyVals.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import scala.annotation.tailrec
88
object LazyVals {
99
private val unsafe = scala.concurrent.util.Unsafe.instance
1010

11-
final val BITS_PER_LAZY_VAL = 2
12-
final val LAZY_VAL_MASK = 3
11+
final val BITS_PER_LAZY_VAL = 2L
12+
final val LAZY_VAL_MASK = 3L
1313

1414
@inline def STATE(cur: Long, ord: Int) = (cur >> (ord * BITS_PER_LAZY_VAL)) & LAZY_VAL_MASK
1515
@inline def CAS(t: Object, offset: Long, e: Long, v: Int, ord: Int) = {

src/dotty/tools/dotc/transform/LazyVals.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ class LazyVals extends MiniPhaseTransform with IdentityDenotTransformer {
341341
// compute or create appropriate offsetSymol, bitmap and bits used by current ValDef
342342
appendOffsetDefs.get(companion.moduleClass) match {
343343
case Some(info) =>
344-
val flagsPerLong = 64 / dotty.runtime.LazyVals.BITS_PER_LAZY_VAL
344+
val flagsPerLong = (64 / dotty.runtime.LazyVals.BITS_PER_LAZY_VAL).toInt
345345
info.ord += 1
346346
ord = info.ord % flagsPerLong
347347
val id = info.ord / flagsPerLong

0 commit comments

Comments
 (0)