mirror of
https://github.com/status-im/nim-stew.git
synced 2025-02-16 14:08:14 +00:00
fix bitops checkedScan and bitScan for vcc
This commit is contained in:
parent
cf82e2d51d
commit
22fabba6df
@ -253,12 +253,12 @@ elif defined(vcc) and useBuiltins:
|
||||
|
||||
template checkedScan(fnc: untyped, x: typed, def: typed): int =
|
||||
var index{.noinit.}: culong
|
||||
if fnc(index.addr, v) == 0: def
|
||||
if fnc(index.addr, v).int == 0: def
|
||||
else: index.int
|
||||
|
||||
template bitScan(fnc: untyped, x: typed): int =
|
||||
var index{.noinit.}: culong
|
||||
if fnc(index.addr, v) == 0: 0
|
||||
if fnc(index.addr, v).int == 0: 0
|
||||
else: index.int
|
||||
|
||||
func countOnesBuiltin(v: uint8|uint16|uint32): int = builtin_popcnt32(v.uint32).int
|
||||
|
Loading…
x
Reference in New Issue
Block a user