mirror of
https://github.com/nim-lang/Nim.git
synced 2026-08-28 09:31:38 +00:00
include system/countbits_impl
This commit is contained in:
@@ -491,7 +491,7 @@ func countSetBits*(x: SomeInteger): int {.inline.} =
|
||||
doAssert countSetBits(0b0000_0011'u8) == 2
|
||||
doAssert countSetBits(0b1010_1010'u8) == 4
|
||||
|
||||
result = countSetBitsImpl(x)
|
||||
result = countSetBitsSysimpl(x)
|
||||
|
||||
func popcount*(x: SomeInteger): int {.inline.} =
|
||||
## Alias for `countSetBits <#countSetBits,SomeInteger>`_ (Hamming weight).
|
||||
|
||||
@@ -58,7 +58,6 @@ import std/private/since
|
||||
# of the standard library!
|
||||
|
||||
import std/[bitops, fenv]
|
||||
import system/countbits_impl
|
||||
|
||||
when defined(nimPreviewSlimSystem):
|
||||
import std/assertions
|
||||
@@ -1302,7 +1301,7 @@ func gcd*[T](x, y: T): T =
|
||||
swap x, y
|
||||
abs x
|
||||
|
||||
when useBuiltins:
|
||||
when not defined(noIntrinsicsBitOpts):
|
||||
## this func uses bitwise comparisons from C compilers, which are not always available.
|
||||
func gcd*(x, y: SomeInteger): SomeInteger =
|
||||
## Computes the greatest common (positive) divisor of `x` and `y`,
|
||||
|
||||
Reference in New Issue
Block a user