Skip to content

bit shift operators take odd types #1570

Closed
@nikomatsakis

Description

@nikomatsakis

It doesn't make much sense to me that in the expression x >> y (resp. x << y) both x and y have to be the same types. After all, it's not like a u32 value as 2^32 bits!

I think y should always be u8 (or perhaps uint if we want to be nice, much as we allow int in array lookups). Actually, does x >> -3 do something sensible, or is -3 just treated as a real big unsigned value?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-type-systemArea: Type systemC-enhancementCategory: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions