Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Mirai
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Mirai
Commits
c854be95
Commit
c854be95
authored
Mar 28, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjust visibility
parent
56728378
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
8 deletions
+4
-8
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/numbers.kt
...re/src/commonMain/kotlin/net.mamoe.mirai/utils/numbers.kt
+4
-8
No files found.
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/numbers.kt
View file @
c854be95
...
@@ -18,8 +18,7 @@ import kotlin.jvm.JvmName
...
@@ -18,8 +18,7 @@ import kotlin.jvm.JvmName
/**
/**
* 要求 [this] 最小为 [min].
* 要求 [this] 最小为 [min].
*/
*/
@Suppress
(
"NOTHING_TO_INLINE"
)
internal
fun
Int
.
coerceAtLeastOrFail
(
min
:
Int
):
Int
{
inline
fun
Int
.
coerceAtLeastOrFail
(
min
:
Int
):
Int
{
require
(
this
>=
min
)
require
(
this
>=
min
)
return
this
return
this
}
}
...
@@ -27,8 +26,7 @@ inline fun Int.coerceAtLeastOrFail(min: Int): Int {
...
@@ -27,8 +26,7 @@ inline fun Int.coerceAtLeastOrFail(min: Int): Int {
/**
/**
* 要求 [this] 最小为 [min].
* 要求 [this] 最小为 [min].
*/
*/
@Suppress
(
"NOTHING_TO_INLINE"
)
internal
fun
Long
.
coerceAtLeastOrFail
(
min
:
Long
):
Long
{
inline
fun
Long
.
coerceAtLeastOrFail
(
min
:
Long
):
Long
{
require
(
this
>=
min
)
require
(
this
>=
min
)
return
this
return
this
}
}
...
@@ -36,12 +34,10 @@ inline fun Long.coerceAtLeastOrFail(min: Long): Long {
...
@@ -36,12 +34,10 @@ inline fun Long.coerceAtLeastOrFail(min: Long): Long {
/**
/**
* 要求 [this] 最大为 [max].
* 要求 [this] 最大为 [max].
*/
*/
@Suppress
(
"NOTHING_TO_INLINE"
)
internal
fun
Int
.
coerceAtMostOrFail
(
max
:
Int
):
Int
=
inline
fun
Int
.
coerceAtMostOrFail
(
max
:
Int
):
Int
=
if
(
this
>=
max
)
error
(
"value is greater than its expected maximum value $max"
)
if
(
this
>=
max
)
error
(
"value is greater than its expected maximum value $max"
)
else
this
else
this
@Suppress
(
"NOTHING_TO_INLINE"
)
internal
fun
Long
.
coerceAtMostOrFail
(
max
:
Long
):
Long
=
inline
fun
Long
.
coerceAtMostOrFail
(
max
:
Long
):
Long
=
if
(
this
>=
max
)
error
(
"value is greater than its expected maximum value $max"
)
if
(
this
>=
max
)
error
(
"value is greater than its expected maximum value $max"
)
else
this
else
this
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment