Libraryless. Click here for Pure Java version (3255L/18K).
1 | // an array of 6-byte integers |
2 | persistable sclass HalfLongs { |
3 | short[] data; |
4 | int length; |
5 | |
6 | *(int *length) { |
7 | data = new short[safeToInt(length*3L)]; |
8 | } |
9 | |
10 | public int size() { ret length; } |
11 | |
12 | public void set(int i, long val) { |
13 | data[i*3] = (short) val; |
14 | data[i*3+1] = (short) (val >> 16); |
15 | data[i*3+2] = (short) (val >> 32); |
16 | } |
17 | |
18 | public long get(int i) { |
19 | ret ushortToLong(data[i*3]) |
20 | | (ushortToLong(data[i*3+1]) << 16) |
21 | | (data[i*3+2] << 32); |
22 | } |
23 | } |
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx
No comments. add comment
Snippet ID: | #1032435 |
Snippet name: | HalfLongs - array of 6-byte integers |
Eternal ID of this version: | #1032435/8 |
Text MD5: | 3b80ca15e4e3e5aeb47949daff14d2f3 |
Transpilation MD5: | 8e45aa9571c3fc35ac9b47ae306ece24 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-09-05 06:37:45 |
Source code size: | 510 bytes / 23 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 254 / 403 |
Version history: | 7 change(s) |
Referenced in: | [show references] |