carbondata-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From QiangCai <...@git.apache.org>
Subject [GitHub] carbondata issue #1065: [CARBONDATA-1196] Add 3 bytes data type support in v...
Date Wed, 21 Jun 2017 08:32:02 GMT
Github user QiangCai commented on the issue:

    https://github.com/apache/carbondata/pull/1065
  
    @jackylk I change the code as following. Two test case passed.
    
    ```
      public static byte[] to3Bytes(int val) {
        return new byte[]{(byte)(val >> 16), (byte)(val >> 8), (byte)(val) };
      }
    
      public static int valueOf3Bytes(byte[] val, int offset) {
        if (val[offset] < 0) {
          return (((val[offset] & 0xffff) << 16) |
                  ((val[offset + 1] & 0xff) << 8) |
                  ((val[offset + 2] & 0xff)));
        } else {
          return (((val[offset] & 0xff) << 16) |
                  ((val[offset + 1] & 0xff) << 8) |
                  ((val[offset + 2] & 0xff)));
        }
      }
    ```
    ```
      private static final int THREE_BYTES_MAX = (int) Math.pow(2, 23) - 1;
      private static final int THREE_BYTES_MIN = - (THREE_BYTES_MAX + 1);
    ```



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message