Github user selvaganesang commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/486#discussion_r63988323
  
    --- Diff: core/conn/jdbcT4/src/main/java/org/trafodion/jdbc/t4/Bytes.java 
---
    @@ -101,19 +103,16 @@ static long extractLong(byte[] array, int offset, 
boolean swap) {
                long value = 0;
                int i=offset;
                
    -           if(swap) {
    -                   for (int shift = 0; shift < 64; shift += 8) {
    -                           value |= ( (long)( array[i] & 0xff ) ) << shift;
    -                           i++;
    -                   }
    -                   
    -           }else {
    -                   for (int shift = 56; shift >= 0; shift -= 8) {
    -                           value |= ( (long)( array[i] & 0xff ) ) << shift;
    -                           i++;
    -                   }
    -           }
    -           
    +        ByteBuffer buffer = ByteBuffer.allocate(8);
    --- End diff --
    
    Can you please consider using ByteBuffer.wrap(array, offset, 8) to avoid 
allocation and then copy the data. In addition, it is not clear what was the 
problem with the original code. A test case or an explanation how it failed 
would be good to understand the issue. My understanding is that shift operator 
would work fine with long data type too.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to