From 3472a16fbc38bcc25f7cc81cef040ad1ea01ccb8 Mon Sep 17 00:00:00 2001 From: tersec Date: Tue, 7 Feb 2023 13:41:40 +0100 Subject: [PATCH] avoid deprecation warnings on Nim 1.6 when using (#121) --- stint/private/uint_div.nim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stint/private/uint_div.nim b/stint/private/uint_div.nim index 1415c4f..2427cdd 100644 --- a/stint/private/uint_div.nim +++ b/stint/private/uint_div.nim @@ -229,6 +229,9 @@ func divmodBS(x, y: UintImpl, q, r: var UintImpl) = const BinaryShiftThreshold = 8 # If the difference in bit-length is below 8 # binary shift is probably faster +# TODO remove when stint removes Nim 1.2 support +import stew/shims/stddefects + func divmod*[T](x, y: UintImpl[T]): tuple[quot, rem: UintImpl[T]]= let x_clz = x.leadingZeros @@ -237,7 +240,7 @@ func divmod*[T](x, y: UintImpl[T]): tuple[quot, rem: UintImpl[T]]= # We short-circuit division depending on special-cases. # TODO: Constant-time division if unlikely(y.isZero): - raise newException(DivByZeroError, "You attempted to divide by zero") + raise newException(DivByZeroDefect, "You attempted to divide by zero") elif y_clz == (bitsof(y) - 1): # y is one result.quot = x