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

24
LINES

< > BotCompany Repo | #1029248 // IIntMemory

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

Libraryless. Click here for Pure Java version (2620L/16K).

sinterface IIntMemory {
  int get(int idx); // idx = unsigned int
  default int read(int idx) { ret get(idx); }
  void set(int idx, int val);
  long size(); // in ints
  
  default int[] readArray(int start, int len) {
    int[] a = new[len];
    for i to len:
      a[i] = get(start+i);
    ret a;
  }
  
  default long getLong(int idx) {
    ret twoIntsToLong(get(idx), get(idx+1));
  }
  
  default void setLong(int idx, long val) {
    set(idx, firstIntFromLong(val));
    set(idx+1, secondIntFromLong(val));
  }
  
  default void ensureSize(int size) { unimplemented(); }
}

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: #1029248
Snippet name: IIntMemory
Eternal ID of this version: #1029248/10
Text MD5: bd200fa7dbe279e42de3bbc2ff2120f5
Transpilation MD5: e48002aeec2852600c495c1f1c8e3780
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-08-07 14:10:08
Source code size: 601 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 219 / 519
Version history: 9 change(s)
Referenced in: [show references]