- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
43 lines
1.3 KiB
Java
43 lines
1.3 KiB
Java
package kotlin.internal;
|
|
|
|
/* loaded from: classes5.dex */
|
|
public abstract class ProgressionUtilKt {
|
|
public static final int mod(int i, int i2) {
|
|
int i3 = i % i2;
|
|
return i3 >= 0 ? i3 : i3 + i2;
|
|
}
|
|
|
|
public static final long mod(long j, long j2) {
|
|
long j3 = j % j2;
|
|
return j3 >= 0 ? j3 : j3 + j2;
|
|
}
|
|
|
|
public static final int differenceModulo(int i, int i2, int i3) {
|
|
return mod(mod(i, i3) - mod(i2, i3), i3);
|
|
}
|
|
|
|
public static final long differenceModulo(long j, long j2, long j3) {
|
|
return mod(mod(j, j3) - mod(j2, j3), j3);
|
|
}
|
|
|
|
public static final int getProgressionLastElement(int i, int i2, int i3) {
|
|
if (i3 > 0) {
|
|
return i >= i2 ? i2 : i2 - differenceModulo(i2, i, i3);
|
|
}
|
|
if (i3 < 0) {
|
|
return i <= i2 ? i2 : i2 + differenceModulo(i, i2, -i3);
|
|
}
|
|
throw new IllegalArgumentException("Step is zero.");
|
|
}
|
|
|
|
public static final long getProgressionLastElement(long j, long j2, long j3) {
|
|
if (j3 > 0) {
|
|
return j >= j2 ? j2 : j2 - differenceModulo(j2, j, j3);
|
|
}
|
|
if (j3 < 0) {
|
|
return j <= j2 ? j2 : j2 + differenceModulo(j, j2, -j3);
|
|
}
|
|
throw new IllegalArgumentException("Step is zero.");
|
|
}
|
|
}
|