Skip to content

[Bug]: clz is counting trailing zeros not leading #422

@Gelthir

Description

@Gelthir

Discord Thread

https://discord.com/channels/828292123936948244/1402304068050751529

What happened?

The built in function clz is returning the number of trailing zeros, not the expect leading zeroes.

Testing with def on_reset($scratch_space: [Int], test: Int) { print(`clz(8): {clz(<U64>8)}`) print(`clz(48): {clz(<U64>48)}`) print(`clz(-128): {clz(<U64>(0 - 128))}`) }

Results in clz(8): 3 clz(48): 5 clz(-128): 63

I'm on x86 while other users report that clz is working correctly on x86.

My CPU is Intel(R) Xeon(R) CPU E3-1230 V2 @ 3.30GHz

Happy to provide any more info if that would help.

Version

2.016 alpha

What OSes are you seeing the problem on?

Windows

Relevant debug.log output, search next to the exectuable

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Needs triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions