Skip to content

Commit

Permalink
refactor: remove inline from codepoint functions
Browse files Browse the repository at this point in the history
This way constants are automatically inlined for those functions.
Plus it results in less JS code.
  • Loading branch information
lppedd committed Sep 17, 2024
1 parent 4431486 commit 0c57e0e
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ internal const val MIN_LOW_SURROGATE: Int = 0xDC00
internal const val HIGH_SURROGATE_ENCODE_OFFSET: Int =
(MIN_HIGH_SURROGATE - (MIN_SUPPLEMENTARY_CODE_POINT_ ushr 10))

internal inline fun isBmpCodePoint(codePoint: Int): Boolean =
internal fun isBmpCodePoint(codePoint: Int): Boolean =
codePoint ushr 16 == 0

internal inline fun highSurrogate(codePoint: Int): Char =
internal fun highSurrogate(codePoint: Int): Char =
((codePoint ushr 10) + HIGH_SURROGATE_ENCODE_OFFSET).toChar()

internal inline fun lowSurrogate(codePoint: Int): Char =
internal fun lowSurrogate(codePoint: Int): Char =
((codePoint and 0x3FF) + MIN_LOW_SURROGATE).toChar()

internal inline fun isValidCodePoint(codePoint: Int): Boolean =
internal fun isValidCodePoint(codePoint: Int): Boolean =
codePoint in 0..MAX_CODE_POINT_

0 comments on commit 0c57e0e

Please sign in to comment.