OpenHashSet.smali
8.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
.class public final Lio/reactivex/internal/util/OpenHashSet;
.super Ljava/lang/Object;
.source "OpenHashSet.java"
# annotations
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">",
"Ljava/lang/Object;"
}
.end annotation
# static fields
.field private static final INT_PHI:I = -0x61c88647
# instance fields
.field keys:[Ljava/lang/Object;
.annotation system Ldalvik/annotation/Signature;
value = {
"[TT;"
}
.end annotation
.end field
.field final loadFactor:F
.field mask:I
.field maxSize:I
.field size:I
# direct methods
.method public constructor <init>()V
.locals 2
const/16 v0, 0x10
const/high16 v1, 0x3f400000 # 0.75f
.line 37
invoke-direct {p0, v0, v1}, Lio/reactivex/internal/util/OpenHashSet;-><init>(IF)V
return-void
.end method
.method public constructor <init>(I)V
.locals 1
const/high16 v0, 0x3f400000 # 0.75f
.line 45
invoke-direct {p0, p1, v0}, Lio/reactivex/internal/util/OpenHashSet;-><init>(IF)V
return-void
.end method
.method public constructor <init>(IF)V
.locals 1
.line 49
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 50
iput p2, p0, Lio/reactivex/internal/util/OpenHashSet;->loadFactor:F
.line 51
invoke-static {p1}, Lio/reactivex/internal/util/Pow2;->roundToPowerOfTwo(I)I
move-result p1
add-int/lit8 v0, p1, -0x1
.line 52
iput v0, p0, Lio/reactivex/internal/util/OpenHashSet;->mask:I
int-to-float v0, p1
mul-float/2addr p2, v0
float-to-int p2, p2
.line 53
iput p2, p0, Lio/reactivex/internal/util/OpenHashSet;->maxSize:I
.line 54
new-array p1, p1, [Ljava/lang/Object;
check-cast p1, [Ljava/lang/Object;
iput-object p1, p0, Lio/reactivex/internal/util/OpenHashSet;->keys:[Ljava/lang/Object;
return-void
.end method
.method static mix(I)I
.locals 1
const v0, -0x61c88647
mul-int/2addr p0, v0
ushr-int/lit8 v0, p0, 0x10
xor-int/2addr p0, v0
return p0
.end method
# virtual methods
.method public add(Ljava/lang/Object;)Z
.locals 6
.annotation system Ldalvik/annotation/Signature;
value = {
"(TT;)Z"
}
.end annotation
.line 58
iget-object v0, p0, Lio/reactivex/internal/util/OpenHashSet;->keys:[Ljava/lang/Object;
.line 59
iget v1, p0, Lio/reactivex/internal/util/OpenHashSet;->mask:I
.line 61
invoke-virtual {p1}, Ljava/lang/Object;->hashCode()I
move-result v2
invoke-static {v2}, Lio/reactivex/internal/util/OpenHashSet;->mix(I)I
move-result v2
and-int/2addr v2, v1
.line 62
aget-object v3, v0, v2
const/4 v4, 0x1
if-eqz v3, :cond_2
.line 64
invoke-virtual {v3, p1}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z
move-result v3
const/4 v5, 0x0
if-eqz v3, :cond_0
return v5
:cond_0
add-int/2addr v2, v4
and-int/2addr v2, v1
.line 69
aget-object v3, v0, v2
if-nez v3, :cond_1
goto :goto_0
.line 73
:cond_1
invoke-virtual {v3, p1}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z
move-result v3
if-eqz v3, :cond_0
return v5
.line 78
:cond_2
:goto_0
aput-object p1, v0, v2
.line 79
iget p1, p0, Lio/reactivex/internal/util/OpenHashSet;->size:I
add-int/2addr p1, v4
iput p1, p0, Lio/reactivex/internal/util/OpenHashSet;->size:I
iget v0, p0, Lio/reactivex/internal/util/OpenHashSet;->maxSize:I
if-lt p1, v0, :cond_3
.line 80
invoke-virtual {p0}, Lio/reactivex/internal/util/OpenHashSet;->rehash()V
:cond_3
return v4
.end method
.method public keys()[Ljava/lang/Object;
.locals 1
.line 169
iget-object v0, p0, Lio/reactivex/internal/util/OpenHashSet;->keys:[Ljava/lang/Object;
return-object v0
.end method
.method rehash()V
.locals 8
.line 136
iget-object v0, p0, Lio/reactivex/internal/util/OpenHashSet;->keys:[Ljava/lang/Object;
.line 137
array-length v1, v0
shl-int/lit8 v2, v1, 0x1
add-int/lit8 v3, v2, -0x1
.line 141
new-array v4, v2, [Ljava/lang/Object;
check-cast v4, [Ljava/lang/Object;
.line 144
iget v5, p0, Lio/reactivex/internal/util/OpenHashSet;->size:I
:goto_0
add-int/lit8 v6, v5, -0x1
if-eqz v5, :cond_3
:goto_1
add-int/lit8 v1, v1, -0x1
.line 145
aget-object v5, v0, v1
if-nez v5, :cond_0
goto :goto_1
.line 146
:cond_0
aget-object v5, v0, v1
invoke-virtual {v5}, Ljava/lang/Object;->hashCode()I
move-result v5
invoke-static {v5}, Lio/reactivex/internal/util/OpenHashSet;->mix(I)I
move-result v5
and-int/2addr v5, v3
.line 147
aget-object v7, v4, v5
if-eqz v7, :cond_2
:cond_1
add-int/lit8 v5, v5, 0x1
and-int/2addr v5, v3
.line 150
aget-object v7, v4, v5
if-nez v7, :cond_1
.line 155
:cond_2
aget-object v7, v0, v1
aput-object v7, v4, v5
move v5, v6
goto :goto_0
.line 158
:cond_3
iput v3, p0, Lio/reactivex/internal/util/OpenHashSet;->mask:I
int-to-float v0, v2
.line 159
iget v1, p0, Lio/reactivex/internal/util/OpenHashSet;->loadFactor:F
mul-float/2addr v0, v1
float-to-int v0, v0
iput v0, p0, Lio/reactivex/internal/util/OpenHashSet;->maxSize:I
.line 160
iput-object v4, p0, Lio/reactivex/internal/util/OpenHashSet;->keys:[Ljava/lang/Object;
return-void
.end method
.method public remove(Ljava/lang/Object;)Z
.locals 5
.annotation system Ldalvik/annotation/Signature;
value = {
"(TT;)Z"
}
.end annotation
.line 85
iget-object v0, p0, Lio/reactivex/internal/util/OpenHashSet;->keys:[Ljava/lang/Object;
.line 86
iget v1, p0, Lio/reactivex/internal/util/OpenHashSet;->mask:I
.line 87
invoke-virtual {p1}, Ljava/lang/Object;->hashCode()I
move-result v2
invoke-static {v2}, Lio/reactivex/internal/util/OpenHashSet;->mix(I)I
move-result v2
and-int/2addr v2, v1
.line 88
aget-object v3, v0, v2
const/4 v4, 0x0
if-nez v3, :cond_0
return v4
.line 92
:cond_0
invoke-virtual {v3, p1}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z
move-result v3
if-eqz v3, :cond_1
.line 93
invoke-virtual {p0, v2, v0, v1}, Lio/reactivex/internal/util/OpenHashSet;->removeEntry(I[Ljava/lang/Object;I)Z
move-result p1
return p1
:cond_1
add-int/lit8 v2, v2, 0x1
and-int/2addr v2, v1
.line 97
aget-object v3, v0, v2
if-nez v3, :cond_2
return v4
.line 101
:cond_2
invoke-virtual {v3, p1}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z
move-result v3
if-eqz v3, :cond_1
.line 102
invoke-virtual {p0, v2, v0, v1}, Lio/reactivex/internal/util/OpenHashSet;->removeEntry(I[Ljava/lang/Object;I)Z
move-result p1
return p1
.end method
.method removeEntry(I[Ljava/lang/Object;I)Z
.locals 4
.annotation system Ldalvik/annotation/Signature;
value = {
"(I[TT;I)Z"
}
.end annotation
.line 108
iget v0, p0, Lio/reactivex/internal/util/OpenHashSet;->size:I
const/4 v1, 0x1
sub-int/2addr v0, v1
iput v0, p0, Lio/reactivex/internal/util/OpenHashSet;->size:I
:goto_0
add-int/lit8 v0, p1, 0x1
:goto_1
and-int/2addr v0, p3
.line 117
aget-object v2, p2, v0
if-nez v2, :cond_0
const/4 p3, 0x0
.line 119
aput-object p3, p2, p1
return v1
.line 122
:cond_0
invoke-virtual {v2}, Ljava/lang/Object;->hashCode()I
move-result v3
invoke-static {v3}, Lio/reactivex/internal/util/OpenHashSet;->mix(I)I
move-result v3
and-int/2addr v3, p3
if-gt p1, v0, :cond_1
if-ge p1, v3, :cond_2
if-le v3, v0, :cond_3
goto :goto_2
:cond_1
if-lt p1, v3, :cond_3
if-le v3, v0, :cond_3
.line 130
:cond_2
:goto_2
aput-object v2, p2, p1
move p1, v0
goto :goto_0
:cond_3
add-int/lit8 v0, v0, 0x1
goto :goto_1
.end method
.method public size()I
.locals 1
.line 173
iget v0, p0, Lio/reactivex/internal/util/OpenHashSet;->size:I
return v0
.end method