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

26
LINES

< > BotCompany Repo | #1029375 - IIntMemory64

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

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

sinterface IIntMemory64 {
  int get(long idx);
  default int read(long idx) { ret get(idx); }
  void set(long idx, int val);
  long size();
  
  default int[] readArray(long start, int len) {
    int[] a = new[len];
    for i to len:
      a[i] = get(start+i);
    ret a;
  }
  
  default int[] readArray(LongRange r) {
    ret r == null ? null : readArray(r.start, toInt(r.length()));
  }
  
  default long getLong(long idx) {
    ret twoIntsToLong(get(idx), get(idx+1));
  }
  
  default void setLong(long idx, long val) {
    set(idx, firstIntFromLong(val));
    set(idx+1, secondIntFromLong(val));
  }
}

Author comment

Began life as a copy of #1029248

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1029375
Snippet name: IIntMemory64
Eternal ID of this version: #1029375/4
Text MD5: 1bcf91fc121a96f96cbc6a322ff5eff4
Transpilation MD5: 8f8e545c47364e96b67dfe97d5f4908c
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-08-09 13:08:29
Source code size: 632 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 55 / 151
Version history: 3 change(s)
Referenced in: #1003674 #1029531

Formerly at http://tinybrain.de/1029375 & http://1029375.tinybrain.de