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

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


The following commit(s) were added to refs/heads/master by this push:
     new 4337a5b  remove code and added TODO
4337a5b is described below

commit 4337a5b8014a31bae9df490d12086c54bd4993db
Author: Sebastian Rühl <sru...@apache.org>
AuthorDate: Fri Mar 9 12:40:39 2018 +0100

    remove code and added TODO
---
 .../plc4x/java/ads/protocol/util/DigestUtil.java   | 23 ++--------------------
 1 file changed, 2 insertions(+), 21 deletions(-)

diff --git 
a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/protocol/util/DigestUtil.java
 
b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/protocol/util/DigestUtil.java
index f6e7d74..ad74dc5 100644
--- 
a/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/protocol/util/DigestUtil.java
+++ 
b/plc4j/protocols/ads/src/main/java/org/apache/plc4x/java/ads/protocol/util/DigestUtil.java
@@ -21,9 +21,6 @@ package org.apache.plc4x.java.ads.protocol.util;
 import io.netty.buffer.ByteBuf;
 import org.apache.plc4x.java.ads.api.util.ByteReadable;
 
-import static java.util.Arrays.stream;
-import static org.apache.commons.lang3.ArrayUtils.toObject;
-
 /**
  * TODO: temporary due to unclear licence
  * From https://stackoverflow.com/a/18333436/850036
@@ -35,11 +32,6 @@ import static org.apache.commons.lang3.ArrayUtils.toObject;
  */
 public class DigestUtil {
 
-    private static final int PRESET_VALUE = 0xFFFF;
-
-    // CRC-16-IBM reversed
-    private static final int POLYNOMIAL = 0xA001;
-
     private DigestUtil() {
         // Utility class
     }
@@ -57,18 +49,7 @@ public class DigestUtil {
     }
 
     public static int calculateCrc16(byte[] bytes) {
-        return (~stream(toObject(bytes))
-            .mapToInt(Byte::intValue)
-            .reduce(PRESET_VALUE, (int crcValue, int aByte) -> {
-                crcValue ^= aByte & 0xFF;
-                for (int j = 0; j < 8; j++) {
-                    if ((crcValue & 1) != 0) {
-                        crcValue = (crcValue >>> 1) ^ POLYNOMIAL;
-                    } else {
-                        crcValue = crcValue >>> 1;
-                    }
-                }
-                return crcValue;
-            })) & 0xFFFF;
+        // TODO: implement me
+        return 0;
     }
 }

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

Reply via email to