File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed
core/shared/src/main/scala/scodec/bits Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -690,6 +690,13 @@ sealed abstract class BitVector
690
690
new IndexedSeq [Boolean ] {
691
691
def length = n
692
692
def apply (idx : Int ): Boolean = BitVector .this .get(idx.toLong)
693
+ override def foldRight [B ](z : B )(op : (Boolean , B ) => B ): B = {
694
+ val it = reverseIterator
695
+ var b = z
696
+ while (it.hasNext)
697
+ b = op(it.next(), b)
698
+ b
699
+ }
693
700
}
694
701
}
695
702
.getOrElse {
Original file line number Diff line number Diff line change @@ -706,6 +706,7 @@ sealed abstract class ByteVector
706
706
new IndexedSeq [Byte ] {
707
707
val length = toIntSize(ByteVector .this .size)
708
708
def apply (i : Int ) = ByteVector .this .apply(i.toLong)
709
+ override def foldRight [B ](z : B )(op : (Byte , B ) => B ): B = ByteVector .this .foldRight(z)(op)
709
710
}
710
711
711
712
/**
You can’t perform that action at this time.
0 commit comments