Trying to upstream changes from the Apache Daffodil project#4
Trying to upstream changes from the Apache Daffodil project#4mbeckerle wants to merge 3 commits intonystrom:masterfrom
Conversation
mbeckerle
left a comment
There was a problem hiding this comment.
Added some comments, markers for a few fixups to put tests back, and reduce the number of whitespace-only changes.
| override def byteValue = intRep.toByte | ||
| override def shortValue = intRep.toShort | ||
|
|
||
| trait SmallUInt[U <: Unsigned[U, UInt, Int]] extends Any with Unsigned[U, UInt, Int] with Serializable { |
There was a problem hiding this comment.
With the exception of the with Serializable change, all the change here could be reverted by just putting back the def intRep.
The only other changes are removal of some commented out code lines, and whitespace changes.
The only necessary change was the "with Serializable"
| class UInt(val intValue: Int) extends AnyVal with SmallUInt[UInt] with Serializable { | ||
| override def toUInt = this | ||
| private def intRep = intValue | ||
| // private def intRep = intValue |
| Promoted <: Unsigned[_, Promoted, SignedPromoted], | ||
| SignedPromoted] | ||
| extends Any with ScalaNumericAnyConversions { | ||
| trait Unsigned[U <: Unsigned[U, Promoted, SignedPromoted], Promoted <: Unsigned[_, Promoted, SignedPromoted], SignedPromoted] |
There was a problem hiding this comment.
Line too long. Could put back to the original indentation.
|
|
||
| import scala.math.ScalaNumericAnyConversions | ||
|
|
||
| @serializable |
There was a problem hiding this comment.
The only change to this file is the "with Serializable". The rest is just whitespace standardization.
| @@ -1,9 +1,34 @@ | |||
| /* | |||
There was a problem hiding this comment.
The only change to this file was adding the banner, Removing commented code (which has been superceded), and whitespace changes.
| import org.scalacheck.Prop._ | ||
| import passera.unsigned._ | ||
|
|
||
| object UnsignedCheck extends Properties("Unsigned") { |
There was a problem hiding this comment.
Put back scalacheck and this properties test-rig. We don't use those in Daffodil, but no reason not to here.
| property(">> and >>> equivalent") = | ||
| forAll { (a: Int, b: Int) => a.toUInt >> (b & 0x1f) == a.toUInt >>> (b & 0x1f) } | ||
|
|
||
| @Test def testLongToString = { |
There was a problem hiding this comment.
These tests should all perhaps go into a separate test class.
| @@ -0,0 +1,65 @@ | |||
| <!-- | |||
| Copyright (c) 2011-2013, Nate Nystrom | |||
There was a problem hiding this comment.
Copyright banners were added to all files that didn't have them. This makes it easier to reuse the source. It meets our source-code labeling requirements.
Daffodil uses this library. We've made some fixes/improvements and would like to get them back into the original master.