You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Chia-Ping Tsai (JIRA)" <ji...@apache.org> on 2018/09/18 14:12:00 UTC

[jira] [Updated] (HBASE-21208) Bytes#toShort doesn't work without unsafe

     [ https://issues.apache.org/jira/browse/HBASE-21208?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chia-Ping Tsai updated HBASE-21208:
-----------------------------------
    Description: 
seems we put the brackets in the wrong place.
{code}
      short n = 0;
      n = (short) ((n ^ bytes[offset]) & 0xFF);
      n = (short) (n << 8);
      n = (short) ((n ^ bytes[offset+1]) & 0xFF);   // this one
      return n;
{code}

  was:
seems we put the brackets in the wrong place :)
{code}
      short n = 0;
      n = (short) ((n ^ bytes[offset]) & 0xFF);
      n = (short) (n << 8);
      n = (short) ((n ^ bytes[offset+1]) & 0xFF);   // this one
      return n;
{code}


> Bytes#toShort doesn't work without unsafe
> -----------------------------------------
>
>                 Key: HBASE-21208
>                 URL: https://issues.apache.org/jira/browse/HBASE-21208
>             Project: HBase
>          Issue Type: Bug
>            Reporter: Chia-Ping Tsai
>            Assignee: Chia-Ping Tsai
>            Priority: Critical
>             Fix For: 2.2.0, 2.1.1, 2.0.3
>
>
> seems we put the brackets in the wrong place.
> {code}
>       short n = 0;
>       n = (short) ((n ^ bytes[offset]) & 0xFF);
>       n = (short) (n << 8);
>       n = (short) ((n ^ bytes[offset+1]) & 0xFF);   // this one
>       return n;
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)