Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

9
LINES

< > BotCompany Repo | #1011481 // compareUtf8

JavaX fragment (include)

1  
static int compareUtf8(byte[] left, byte[] right) {
2  
  int n = min(left.length, right.length);
3  
  for (int i = 0; i < n; i++) {
4  
    int a = left[i] & 0xff;
5  
    int b = right[i] & 0xff;
6  
    if (a != b) ret a-b;
7  
  }
8  
  ret left.length - right.length;
9  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1011481
Snippet name: compareUtf8
Eternal ID of this version: #1011481/1
Text MD5: 1aaaaa141e34c2a9fee277bd2af99a49
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-10-30 02:17:21
Source code size: 255 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 446 / 477
Referenced in: [show references]