这是indexloc提供的服务,不要输入任何密码
Skip to content

integer bit shift by bit width or more #289

@dneto0

Description

@dneto0

What happens when an integer A is shifted by an amount B where B is equal to or greater than the number of bits in A? This applies to both left shift and right shift.

C++ has has various answers over time, see https://en.cppreference.com/w/cpp/language/operator_arithmetic#Bitwise_shift_operators

It's common to say undefined results occur if the shift width is equal or greater to the bit width. SPIR-V does this because it's the common case in ISAs.

What do we want to do here?
I don't think we have to cater to applications which do use very large shifts, and we can make them slow to make them consistent. But I'd like to keep the small shifts fast.

Metadata

Metadata

Assignees

No one assigned

    Labels

    copyeditingPure editorial stuff (copyediting, *.bs file syntax, etc.)programming modelwgslWebGPU Shading Language Issues

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions