You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by jm...@apache.org on 2018/02/27 06:53:55 UTC

[incubator-plc4x] 01/03: unnneeded brackets

This is an automated email from the ASF dual-hosted git repository.

jmclean pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git

commit 0863a31979916d2c2771c5a2a36ffe161c2e3fab
Author: Justin Mclean <jm...@apache.org>
AuthorDate: Tue Feb 27 17:31:13 2018 +1100

    unnneeded brackets
---
 .../org/apache/plc4x/java/ads/netty/util/LittleEndianDecoder.java  | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/netty/util/LittleEndianDecoder.java b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/netty/util/LittleEndianDecoder.java
index e37f2f2..6d58d0b 100644
--- a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/netty/util/LittleEndianDecoder.java
+++ b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/netty/util/LittleEndianDecoder.java
@@ -57,20 +57,20 @@ public class LittleEndianDecoder {
             } else {
                 byte byteTwo = adsData[i + 1];
                 if (datatype == Short.class) {
-                    result.add((short) (((byteOne & 0xff) & 0xff) | ((byteTwo & 0xff) << 8)));
+                    result.add((short) ((byteOne & 0xff) | ((byteTwo & 0xff) << 8)));
                     i += 2;
                 } else {
                     byte byteThree = adsData[i + 2];
                     byte byteFour = adsData[i + 3];
                     if (datatype == Integer.class) {
-                        result.add(((byteOne & 0xff)) | ((byteTwo & 0xff) << 8) | ((byteThree & 0xff) << 16) | ((byteFour & 0xff)) << 24);
+                        result.add((byteOne & 0xff) | ((byteTwo & 0xff) << 8) | ((byteThree & 0xff) << 16) | (byteFour & 0xff) << 24);
                         i += 4;
                     } else if (datatype == Float.class) {
                         // TODO: check how ads expects this data
                         // Description of the Real number format:
                         // https://www.sps-lehrgang.de/zahlenformate-step7/#c144
                         // https://de.wikipedia.org/wiki/IEEE_754
-                        int intValue = ((byteOne & 0xff)) | ((byteTwo & 0xff) << 8) | ((byteThree & 0xff) << 16) | ((byteFour & 0xff) << 24);
+                        int intValue = (byteOne & 0xff) | ((byteTwo & 0xff) << 8) | ((byteThree & 0xff) << 16) | ((byteFour & 0xff) << 24);
                         result.add(Float.intBitsToFloat(intValue));
                         i += 4;
                     } else {
@@ -87,7 +87,6 @@ public class LittleEndianDecoder {
                                     byteSeven,
                                     byteSix,
                                     byteFive,
-
                                     byteFour,
                                     byteThree,
                                     byteTwo,

-- 
To stop receiving notification emails like this one, please contact
jmclean@apache.org.