@@ -93,12 +93,14 @@ public sealed class Counter private constructor() {
9393 * - [incrementBy] is less than or equal to 0
9494 * - [incrementBy] is greater than [MAX_INCREMENT]
9595 * - [incrementBy] is not a factor of 8
96+ * - [incrementBy] does not go into [Int.MIN_VALUE] (i.e. when `Int.MIN_VALUE % incrementBy != 0`)
9697 * - [lo] is not a factor of [incrementBy]
9798 * */
9899 public constructor (lo: Int , hi: Int , incrementBy: Int ): super () {
99100 require(incrementBy > 0 ) { " incrementBy[$incrementBy ] must be greater than 0" }
100101 require(incrementBy <= MAX_INCREMENT ) { " incrementBy[$incrementBy ] must be less than or equal to $MAX_INCREMENT " }
101102 require(incrementBy % 8 == 0 ) { " incrementBy[$incrementBy ] must be a factor of 8" }
103+ require(Int .MIN_VALUE % incrementBy == 0 ) { " Int.MIN_VALUE % incrementBy[$incrementBy ] != 0" }
102104 require(lo % incrementBy == 0 ) { " lo must be a factor of incrementBy[$incrementBy ]" }
103105
104106 this .incrementBy = incrementBy
@@ -113,6 +115,7 @@ public sealed class Counter private constructor() {
113115 * - Less than or equal to 0
114116 * - Greater than [MAX_INCREMENT]
115117 * - Not a factor of 8
118+ * - Does not go into [Int.MIN_VALUE] (i.e. when `Int.MIN_VALUE % incrementBy != 0`)
116119 * */
117120 public constructor (incrementBy: Int ): this (0 , 0 , incrementBy)
118121
@@ -210,12 +213,14 @@ public sealed class Counter private constructor() {
210213 * - [incrementBy] is less than or equal to 0
211214 * - [incrementBy] is greater than [MAX_INCREMENT]
212215 * - [incrementBy] is not a factor of 8
216+ * - [incrementBy] does not go into [Long.MIN_VALUE] (i.e. when `Long.MIN_VALUE % incrementBy != 0`)
213217 * - [lo] is not a factor of [incrementBy]
214218 * */
215219 public constructor (lo: Long , hi: Long , incrementBy: Long ): super () {
216220 require(incrementBy > 0L ) { " incrementBy[$incrementBy ] must be greater than 0" }
217221 require(incrementBy <= MAX_INCREMENT ) { " incrementBy[$incrementBy ] must be less than or equal to $MAX_INCREMENT " }
218222 require(incrementBy % 8 == 0L ) { " incrementBy[$incrementBy ] must be a factor of 8" }
223+ require(Long .MIN_VALUE % incrementBy == 0L ) { " Long.MIN_VALUE % incrementBy[$incrementBy ] != 0" }
219224 require(lo % incrementBy == 0L ) { " lo must be a factor of incrementBy[$incrementBy ]" }
220225
221226 this .incrementBy = incrementBy
@@ -230,6 +235,7 @@ public sealed class Counter private constructor() {
230235 * - Less than or equal to 0
231236 * - Greater than [MAX_INCREMENT]
232237 * - Not a factor of 8
238+ * - Does not go into [Long.MIN_VALUE] (i.e. when `Long.MIN_VALUE % incrementBy != 0`)
233239 * */
234240 public constructor (incrementBy: Long ): this (0 , 0 , incrementBy)
235241
0 commit comments