Skip to content

Doc discussing bitfield positions should clarify which position is least significant #5303

@aaeberharter

Description

@aaeberharter

While the specification for insertBits and similar built-ins are very precise with their use of bit positions they miss one crucial detail: They do not declare whether bit 0 or bit 31 is least significant (or 15, 63 for some types).

This information is especially relevant when the result of bit-operations is used with hard-to-debug arithmetic operations e.g. target blend states or atomic operations.

I think a simple line like:
The least significant bit is at position 0
would suffice if added to all affected functions. Built-ins which come to mind are:

extractBits, insertBits, firstLeadingBit, firstTrailingBit as well as all pack... and unpack... functions.

Summary:
The concept of least and most significant bit is never associated with numerical bit positions

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions