blob: 1dace6f2725a1d1c127301657d6cb449367421fa [file] [log] [blame]
// Copyright (c) 2016, the R8 project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
package com.android.tools.r8.code;
import static com.android.tools.r8.dex.Constants.U16BIT_MAX;
import com.android.tools.r8.dex.IndexedItemCollection;
import com.android.tools.r8.graph.ObjectToOffsetMapping;
import com.android.tools.r8.naming.ClassNameMapper;
import java.nio.ShortBuffer;
abstract class Format32x extends Base3Format {
public final int AAAA;
public final int BBBB;
// ΓΈΓΈ | op | AAAA | BBBB
Format32x(int high, BytecodeStream stream) {
super(stream);
AAAA = read16BitValue(stream);
BBBB = read16BitValue(stream);
}
Format32x(int dest, int src) {
assert 0 <= dest && dest <= U16BIT_MAX;
assert 0 <= src && src <= U16BIT_MAX;
AAAA = dest;
BBBB = src;
}
public void write(ShortBuffer dest, ObjectToOffsetMapping mapping) {
writeFirst(0, dest);
write16BitValue(AAAA, dest);
write16BitValue(BBBB, dest);
}
public final int hashCode() {
return ((AAAA << 16) | BBBB) ^ getClass().hashCode();
}
public final boolean equals(Object other) {
if (other == null || (this.getClass() != other.getClass())) {
return false;
}
Format32x o = (Format32x) other;
return o.AAAA == AAAA && o.BBBB == BBBB;
}
public String toString(ClassNameMapper naming) {
return formatString("v" + AAAA + ", v" + BBBB);
}
public String toSmaliString(ClassNameMapper naming) {
return formatSmaliString("v" + AAAA + ", v" + BBBB);
}
@Override
public void collectIndexedItems(IndexedItemCollection indexedItems) {
// No references.
}
}