Closed DelevoXDG closed 3 weeks ago
Hello, can you elaborate more?
Hello, I would like to participate and be able to give my first contribution, I would like more details, I hope you will take me into account, thank you!
Hey @ChielokaCode @xJeffx23 , in some places in our code, BigInteger
methods are used to perform mathematical calculations. The goal is to replace them with kotlin operators.
Here's a little example:
low.add(high.shiftLeft(SHIFT))
should be replaced with
low + high.shiftLeft(SHIFT)
You're welcome to provide a PR for that and we will allocate some time to review it.
Hello @franciszekjob, did you give me permission to push, i have modified 10 files where BigInteger methods where used to Kotlin operators
@ChielokaCode in order to contribute, you need to open a pull request from separate branch, which then could be merged into main
.
I am applying to this issue via OnlyDust platform.
I'm mobile developer with 4 years of experience. My background is Java (1), Kotlin (3), Dart (1), Android (4) and Flutter (1). I have worked in both corporate and freelance environments. I love Kotlin. It's my favorite language programming. Sometimes, I like to look programming problems on Internet and solve it. This issue sounds like something similar.
First, I need to check the calculations that needs to be refactored. Depends on that, I could create functions for handle those calculations. Considering Kotlin allows operator overload, I could do something like this in order to refactor and existing method to use overloaded operators:
Code before refactoring:
data class Vector(val x: Int, val y: Int) {
fun add(other: Vector): Vector {
return Vector(this.x + other.x, this.y + other.y)
}
}
val v1 = Vector(1, 2) val v2 = Vector(3, 4)
val sum = v1.add(v2)
Code after refactoring:
data class Vector(val x: Int, val y: Int) {
operator fun plus(other: Vector): Vector {
return Vector(this.x + other.x, this.y + other.y)
}
}
val v1 = Vector(1, 2) val v2 = Vector(3, 4)
val sum = v1 + v2
If this approach is not satisfactory, please, let me know. If you have a suggestion about how this might be handle it, don't hesitate to chat with me.
Ey@ChielokaCode @xJeffx23En algunos lugares de nuestro código
BigInteger
se utilizan métodos para realizar cálculos matemáticos. El objetivo es reemplazarlos con operadores de Kotlin.He aquí un pequeño ejemplo:
low.add(high.shiftLeft(SHIFT))
Debería reemplazarse por
low + high shl SHIFT
Le invitamos a proporcionar una PR para eso y le dedicaremos algo de tiempo para revisarla.
I have made the necessary changes to replace the BigInteger methods with Kotlin operators in our code. Here are the details:
Changes made: low.add(high.shiftLeft(SHIFT)) has been replaced with low + (high shl SHIFT) low.subtract(high) has been replaced with low - high low.multiply(high) has been replaced with low * high low.divide(high) has been replaced with low / high low.mod(high) has been replaced with low % high Justification: These changes make the code cleaner and more idiomatic in Kotlin, leveraging the language's available operators for mathematical operations.
Testing: I have run all existing tests and added new tests to ensure that these changes do not introduce any errors.
Please review these changes and let me know if any further adjustments are needed.
I am applying to this issue via OnlyDust platform.
With a strong background in Kotlin development, I excel in leveraging Kotlin’s features to build efficient and maintainable applications. My expertise spans core language features, functional programming, and seamless Java interoperability. I bring hands-on experience from Android development and a commitment to best practices like unit testing and continuous integration. Staying updated with the latest trends, I am skilled at applying Kotlin's strengths to solve complex problems and deliver high-quality software solutions.
1 - Identify Usage: Find where BigInteger methods are used in the code. 2 Implement Operators: Define Kotlin operator extensions for BigInteger if needed (e.g., plus, minus). 3 Refactor Code: Replace method calls with the new operators. 4 Test: Run unit and regression tests to ensure functionality is intact. 5 Review: Have the changes reviewed and update documentation. 6 Deploy: Merge changes and monitor for any issues.
Feature Request
Self-explanatory. Should improve readability of some calculations