package io.netty.handler.codec.redis;

import io.netty.handler.codec.dns.DnsRecord;
import io.netty.handler.codec.http2.Http2CodecUtil;
import io.netty.util.CharsetUtil;
import io.netty.util.internal.PlatformDependent;

/* JADX INFO: loaded from: classes.dex */
public final class RedisCodecUtil {
    private RedisCodecUtil() {
    }

    public static byte[] longToAsciiBytes(long j2) {
        return Long.toString(j2).getBytes(CharsetUtil.US_ASCII);
    }

    public static short makeShort(char c2, char c3) {
        return (short) (PlatformDependent.BIG_ENDIAN_NATIVE_ORDER ? c2 | (c3 << '\b') : (c2 << '\b') | c3);
    }

    public static byte[] shortToBytes(short s2) {
        byte[] bArr = new byte[2];
        if (PlatformDependent.BIG_ENDIAN_NATIVE_ORDER) {
            bArr[1] = (byte) ((s2 >> 8) & DnsRecord.CLASS_ANY);
            bArr[0] = (byte) (s2 & Http2CodecUtil.MAX_UNSIGNED_BYTE);
        } else {
            bArr[0] = (byte) ((s2 >> 8) & DnsRecord.CLASS_ANY);
            bArr[1] = (byte) (s2 & Http2CodecUtil.MAX_UNSIGNED_BYTE);
        }
        return bArr;
    }
}
