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

19
LINES

< > BotCompany Repo | #1033223 // byteArrayToIntList_littleEndian

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (4061L/23K).

1  
static L<Int> byteArrayToIntList_littleEndian(byte[] a) {
2  
  if (a == null) null;
3  
  int n = (a.length+3)/4;
4  
  
5  
  ret new RandomAccessAbstractList<Int>() {
6  
    public int size() { ret n; }
7  
    
8  
    public Int get(int i) {
9  
      ret intFromBytes_littleEndian_partial(a, i*4);
10  
    }
11  
    
12  
    public Int set(int i, Int val) {
13  
      Int old = get(i);
14  
      if ((int) old != (int) val)
15  
        intToBytes_inArray_littleEndian_partial(val, a, i*4);
16  
      ret old;
17  
    }
18  
  };
19  
}

Author comment

Began life as a copy of #1033132

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033223
Snippet name: byteArrayToIntList_littleEndian
Eternal ID of this version: #1033223/3
Text MD5: 84e01f7c18aff1bb700efa6351a67099
Transpilation MD5: acd9f64692e3385c3025900fe6d3dab9
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-16 05:56:01
Source code size: 486 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 148 / 214
Version history: 2 change(s)
Referenced in: [show references]