- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Byte Class Logical Operators
Anyone know if there is a reason the bitwise logical operators of the
Byte class return an Int when the right hand is a Byte also?
Anyone know if there is a reason the bitwise logical operators of the
Byte class return an Int when the right hand is a Byte also?
Copyright © 2013 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland
Re: Byte Class Logical Operators
--Rex
On Wed, Sep 28, 2011 at 12:19 AM, Billy <rossrose69 [at] gmail [dot] com> wrote:
Re: Byte Class Logical Operators
Billy
On Sep 27, 2011, at 23:39, Rex Kerr <ichoran [at] gmail [dot] com> wrote:
Re: Byte Class Logical Operators
On 2011.09.28. 20:00, Ross Rose wrote:
> Odd, I've never had to convert an operation between two bytes in java to
> a byte because the result was an int.
Maybe you were using ^=, and like operators. Those are defined to cast
back (in Java, not in Scala) to the type of the variable on left. (It
might get surprising, when you would expect an error (for example the
variable is an integral type, but the right side has a floating type),
but a silent conversion happen.)