Expose internal getProgressionLastElement to public api

To be used in compiler loop optimizations.
#KT-18869 Fixed
This commit is contained in:
Ilya Gorbunov
2017-12-07 21:55:58 +03:00
parent c453ff01cd
commit 479f293edc
3 changed files with 12 additions and 0 deletions
@@ -49,6 +49,7 @@ private fun differenceModulo(a: Long, b: Long, c: Long): Long {
* @return the final element of the progression
* @suppress
*/
@PublishedApi
internal fun getProgressionLastElement(start: Int, end: Int, step: Int): Int {
if (step > 0) {
return end - differenceModulo(end, start, step)
@@ -74,6 +75,7 @@ internal fun getProgressionLastElement(start: Int, end: Int, step: Int): Int {
* @return the final element of the progression
* @suppress
*/
@PublishedApi
internal fun getProgressionLastElement(start: Long, end: Long, step: Long): Long {
if (step > 0) {
return end - differenceModulo(end, start, step)