You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2022/02/26 00:54:04 UTC

[GitHub] [iotdb] HTHou commented on a change in pull request #5118: [IOTDB-2609] A new lossy encoding method based on frequency domain

HTHou commented on a change in pull request #5118:
URL: https://github.com/apache/iotdb/pull/5118#discussion_r815241047



##########
File path: tsfile/src/main/java/org/apache/iotdb/tsfile/utils/BitConstructor.java
##########
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2021 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.iotdb.tsfile.utils;
+
+import org.eclipse.collections.impl.list.mutable.primitive.ByteArrayList;
+
+/**
+ * 大端,低字节存储高位
+ *
+ * @author Wang Haoyu
+ */
+public class BitConstructor {
+
+  private static final int BITS_IN_A_BYTE = 8;
+  private static final long ALL_MASK = -1;
+  private final ByteArrayList data;
+  private byte cache = 0;
+  private int cnt = 0;
+
+  public BitConstructor() {
+    this.data = new ByteArrayList();
+  }
+
+  public BitConstructor(int initialCapacity) {
+    this.data = new ByteArrayList(initialCapacity);
+  }
+
+  public void add(long x, int len) {
+    x = x & ~(ALL_MASK << len); // 保证x除最低的len位之外都是0

Review comment:
       Use english?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org