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

26
LINES

< > BotCompany Repo | #1029531 // IByteMemory64

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

Libraryless. Click here for Pure Java version (2634L/17K).

1  
sinterface IByteMemory64 {
2  
  byte getByte(long idx);
3  
  int getInt(long idx);
4  
  //void setByte(long idx, byte val);
5  
  long size();
6  
  
7  
  default int[] readIntArray(long start, int len) {
8  
    int[] a = new[len];
9  
    for i to len:
10  
      a[i] = getInt(start+(((long) i) << 2));
11  
    ret a;
12  
  }
13  
  
14  
  default int[] readIntArray(LongRange r) {
15  
    ret r == null ? null : readIntArray(r.start, toInt(r.length()));
16  
  }
17  
  
18  
  default long getLong(long idx) {
19  
    ret twoIntsToLong(getInt(idx), getInt(idx+4));
20  
  }
21  
  
22  
  /*default void setLong(long idx, long val) {
23  
    setInt(idx, firstIntFromLong(val));
24  
    setInt(idx+4, secondIntFromLong(val));
25  
  }*/
26  
}

Author comment

Began life as a copy of #1029375

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1029531
Snippet name: IByteMemory64
Eternal ID of this version: #1029531/3
Text MD5: c8a5bd9d318faf76e40c1fffa1bc1d3c
Transpilation MD5: 2823f8012661a2e0a736d9a140a66f58
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-08-17 23:20:04
Source code size: 666 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 158 / 411
Version history: 2 change(s)
Referenced in: [show references]