EncodedValueCodec.smali

.class public final Lcom/tencent/tinker/android/dex/EncodedValueCodec;
.super Ljava/lang/Object;


# direct methods
.method private constructor <init>()V
    .registers 1

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method public static readSignedInt(Lcom/tencent/tinker/android/dex/util/ByteInput;I)I
    .registers 5

    const/4 v0, 0x0

    move v1, v0

    move v0, p1

    :goto_3
    if-ltz v0, :cond_13

    ushr-int/lit8 v1, v1, 0x8

    invoke-interface {p0}, Lcom/tencent/tinker/android/dex/util/ByteInput;->readByte()B

    move-result v2

    and-int/lit16 v2, v2, 0xff

    shl-int/lit8 v2, v2, 0x18

    or-int/2addr v1, v2

    add-int/lit8 v0, v0, -0x1

    goto :goto_3

    :cond_13
    rsub-int/lit8 v0, p1, 0x3

    mul-int/lit8 v0, v0, 0x8

    shr-int v0, v1, v0

    return v0
.end method

.method public static readSignedLong(Lcom/tencent/tinker/android/dex/util/ByteInput;I)J
    .registers 10

    const-wide/16 v0, 0x0

    move-wide v2, v0

    move v0, p1

    :goto_4
    if-ltz v0, :cond_18

    const/16 v1, 0x8

    ushr-long/2addr v2, v1

    invoke-interface {p0}, Lcom/tencent/tinker/android/dex/util/ByteInput;->readByte()B

    move-result v1

    int-to-long v4, v1

    const-wide/16 v6, 0xff

    and-long/2addr v4, v6

    const/16 v1, 0x38

    shl-long/2addr v4, v1

    or-long/2addr v2, v4

    add-int/lit8 v0, v0, -0x1

    goto :goto_4

    :cond_18
    rsub-int/lit8 v0, p1, 0x7

    mul-int/lit8 v0, v0, 0x8

    shr-long v0, v2, v0

    return-wide v0
.end method

.method public static readUnsignedInt(Lcom/tencent/tinker/android/dex/util/ByteInput;IZ)I
    .registers 6

    const/4 v0, 0x0

    if-nez p2, :cond_1c

    move v1, v0

    move v0, p1

    :goto_5
    if-ltz v0, :cond_15

    ushr-int/lit8 v1, v1, 0x8

    invoke-interface {p0}, Lcom/tencent/tinker/android/dex/util/ByteInput;->readByte()B

    move-result v2

    and-int/lit16 v2, v2, 0xff

    shl-int/lit8 v2, v2, 0x18

    or-int/2addr v1, v2

    add-int/lit8 v0, v0, -0x1

    goto :goto_5

    :cond_15
    rsub-int/lit8 v0, p1, 0x3

    mul-int/lit8 v0, v0, 0x8

    ushr-int v0, v1, v0

    :cond_1b
    return v0

    :cond_1c
    :goto_1c
    if-ltz p1, :cond_1b

    ushr-int/lit8 v0, v0, 0x8

    invoke-interface {p0}, Lcom/tencent/tinker/android/dex/util/ByteInput;->readByte()B

    move-result v1

    and-int/lit16 v1, v1, 0xff

    shl-int/lit8 v1, v1, 0x18

    or-int/2addr v0, v1

    add-int/lit8 p1, p1, -0x1

    goto :goto_1c
.end method

.method public static readUnsignedLong(Lcom/tencent/tinker/android/dex/util/ByteInput;IZ)J
    .registers 13

    const-wide/16 v8, 0xff

    const/16 v7, 0x38

    const/16 v6, 0x8

    const-wide/16 v0, 0x0

    if-nez p2, :cond_21

    move-wide v2, v0

    move v0, p1

    :goto_c
    if-ltz v0, :cond_1a

    ushr-long/2addr v2, v6

    invoke-interface {p0}, Lcom/tencent/tinker/android/dex/util/ByteInput;->readByte()B

    move-result v1

    int-to-long v4, v1

    and-long/2addr v4, v8

    shl-long/2addr v4, v7

    or-long/2addr v2, v4

    add-int/lit8 v0, v0, -0x1

    goto :goto_c

    :cond_1a
    rsub-int/lit8 v0, p1, 0x7

    mul-int/lit8 v0, v0, 0x8

    ushr-long v0, v2, v0

    :cond_20
    return-wide v0

    :cond_21
    :goto_21
    if-ltz p1, :cond_20

    ushr-long/2addr v0, v6

    invoke-interface {p0}, Lcom/tencent/tinker/android/dex/util/ByteInput;->readByte()B

    move-result v2

    int-to-long v2, v2

    and-long/2addr v2, v8

    shl-long/2addr v2, v7

    or-long/2addr v0, v2

    add-int/lit8 p1, p1, -0x1

    goto :goto_21
.end method

.method public static writeRightZeroExtendedValue(Lcom/tencent/tinker/android/dex/util/ByteOutput;IJ)V
    .registers 8

    invoke-static {p2, p3}, Ljava/lang/Long;->numberOfTrailingZeros(J)I

    move-result v0

    rsub-int/lit8 v0, v0, 0x40

    if-nez v0, :cond_9

    const/4 v0, 0x1

    :cond_9
    add-int/lit8 v0, v0, 0x7

    shr-int/lit8 v0, v0, 0x3

    mul-int/lit8 v1, v0, 0x8

    rsub-int/lit8 v1, v1, 0x40

    shr-long v2, p2, v1

    add-int/lit8 v1, v0, -0x1

    shl-int/lit8 v1, v1, 0x5

    or-int/2addr v1, p1

    invoke-interface {p0, v1}, Lcom/tencent/tinker/android/dex/util/ByteOutput;->writeByte(I)V

    :goto_1b
    if-lez v0, :cond_28

    long-to-int v1, v2

    int-to-byte v1, v1

    invoke-interface {p0, v1}, Lcom/tencent/tinker/android/dex/util/ByteOutput;->writeByte(I)V

    const/16 v1, 0x8

    shr-long/2addr v2, v1

    add-int/lit8 v0, v0, -0x1

    goto :goto_1b

    :cond_28
    return-void
.end method

.method public static writeSignedIntegralValue(Lcom/tencent/tinker/android/dex/util/ByteOutput;IJ)V
    .registers 6

    const/16 v0, 0x3f

    shr-long v0, p2, v0

    xor-long/2addr v0, p2

    invoke-static {v0, v1}, Ljava/lang/Long;->numberOfLeadingZeros(J)I

    move-result v0

    rsub-int/lit8 v0, v0, 0x41

    add-int/lit8 v0, v0, 0x7

    shr-int/lit8 v0, v0, 0x3

    add-int/lit8 v1, v0, -0x1

    shl-int/lit8 v1, v1, 0x5

    or-int/2addr v1, p1

    invoke-interface {p0, v1}, Lcom/tencent/tinker/android/dex/util/ByteOutput;->writeByte(I)V

    :goto_17
    if-lez v0, :cond_24

    long-to-int v1, p2

    int-to-byte v1, v1

    invoke-interface {p0, v1}, Lcom/tencent/tinker/android/dex/util/ByteOutput;->writeByte(I)V

    const/16 v1, 0x8

    shr-long/2addr p2, v1

    add-int/lit8 v0, v0, -0x1

    goto :goto_17

    :cond_24
    return-void
.end method

.method public static writeUnsignedIntegralValue(Lcom/tencent/tinker/android/dex/util/ByteOutput;IJ)V
    .registers 6

    invoke-static {p2, p3}, Ljava/lang/Long;->numberOfLeadingZeros(J)I

    move-result v0

    rsub-int/lit8 v0, v0, 0x40

    if-nez v0, :cond_9

    const/4 v0, 0x1

    :cond_9
    add-int/lit8 v0, v0, 0x7

    shr-int/lit8 v0, v0, 0x3

    add-int/lit8 v1, v0, -0x1

    shl-int/lit8 v1, v1, 0x5

    or-int/2addr v1, p1

    invoke-interface {p0, v1}, Lcom/tencent/tinker/android/dex/util/ByteOutput;->writeByte(I)V

    :goto_15
    if-lez v0, :cond_22

    long-to-int v1, p2

    int-to-byte v1, v1

    invoke-interface {p0, v1}, Lcom/tencent/tinker/android/dex/util/ByteOutput;->writeByte(I)V

    const/16 v1, 0x8

    shr-long/2addr p2, v1

    add-int/lit8 v0, v0, -0x1

    goto :goto_15

    :cond_22
    return-void
.end method