This source file includes following definitions.
- newData
- getValue
- getIndex
- putValue
- putIndex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package mpi;
22
23
24
25
26 public final class LongInt extends Struct
27 {
28 private final int lSize, iOff, iSize;
29
30
31
32
33
34
35
36
37 protected LongInt(int longSize, int intOff, int intSize)
38 {
39 lSize = longSize;
40 iSize = intSize;
41 int lOff;
42
43 switch(lSize)
44 {
45 case 4: lOff = addInt(); break;
46 case 8: lOff = addLong(); break;
47 default: throw new AssertionError("Unsupported long size: "+ lSize);
48 }
49
50 assert lOff == 0;
51 setOffset(intOff);
52
53 switch(iSize)
54 {
55 case 4: iOff = addInt(); break;
56 case 8: iOff = addLong(); break;
57 default: throw new AssertionError("Unsupported int size: "+ iSize);
58 }
59
60 assert(intOff == iOff);
61 }
62
63
64
65
66
67 @Override protected LongInt.Data newData()
68 {
69 return new LongInt.Data();
70 }
71
72
73
74
75 public final class Data extends Struct.Data
76 {
77
78
79
80
81 public long getValue()
82 {
83 switch(lSize)
84 {
85 case 8: return getLong(0);
86 case 4: return getInt(0);
87 default: throw new AssertionError();
88 }
89 }
90
91
92
93
94
95 public int getIndex()
96 {
97 switch(iSize)
98 {
99 case 4: return getInt(iOff);
100 case 8: return (int)getLong(iOff);
101 default: throw new AssertionError();
102 }
103 }
104
105
106
107
108
109 public void putValue(long v)
110 {
111 switch(lSize)
112 {
113 case 8: putLong(0, v); break;
114 case 4: putInt(0, (int)v); break;
115 default: throw new AssertionError();
116 }
117 }
118
119
120
121
122
123 public void putIndex(int v)
124 {
125 switch(iSize)
126 {
127 case 4: putInt(iOff, v); break;
128 case 8: putLong(iOff, v); break;
129 default: throw new AssertionError();
130 }
131 }
132 }
133
134 }